@pytest.mark.parametrize('env, expected', [({'FOO': 'bar'}, ''), ({'FOO': 'bar', 'LC_ALL': 'baz'}, 'LC_ALL = baz'), ({'LC_ALL': 'baz', 'PYTHONFOO': 'fish'}, 'LC_ALL = baz\nPYTHONFOO = fish'), ({'DE': 'KDE', 'DESKTOP_SESSION': 'plasma'}, 'DE = KDE\nDESKTOP_SESSION = plasma'), ({'QT5_IM_MODULE': 'fcitx', 'QT_IM_MODULE': 'fcitx'}, 'QT_IM_MODULE = fcitx'), ({'LANGUAGE': 'foo', 'LANG': 'en_US.UTF-8'}, 'LANG = en_US.UTF-8'), ({'FOO': 'bar', 'QUTE_BLAH': '1'}, 'QUTE_BLAH = 1')], ids=(lambda e: e[1]))
def test_get_environment_vars(monkeypatch, env, expected):
 for key in os.environ.copy():
  monkeypatch.delenv(key)
 for (k, v) in env.items():
  monkeypatch.setenv(k, v)
 assert (crashdialog._get_environment_vars() == expected)

@ pytest . mark . parametrize ( 'env, expected' , [ ( { 'FOO' : 'bar' } , '' ) , ( { 'FOO' : 'bar' , 'LC_ALL' : 'baz' } , 'LC_ALL = baz' ) , ( { 'LC_ALL' : 'baz' , 'PYTHONFOO' : 'fish' } , 'LC_ALL = baz\nPYTHONFOO = fish' ) , ( { 'DE' : 'KDE' , 'DESKTOP_SESSION' : 'plasma' } , 'DE = KDE\nDESKTOP_SESSION = plasma' ) , ( { 'QT5_IM_MODULE' : 'fcitx' , 'QT_IM_MODULE' : 'fcitx' } , 'QT_IM_MODULE = fcitx' ) , ( { 'LANGUAGE' : 'foo' , 'LANG' : 'en_US.UTF-8' } , 'LANG = en_US.UTF-8' ) , ( { 'FOO' : 'bar' , 'QUTE_BLAH' : '1' } , 'QUTE_BLAH = 1' ) ] , ids = ( lambda e : e [ 1 ] ) ) def test_get_environment_vars ( monkeypatch , env , expected ) : for key in os . environ . copy ( ) : monkeypatch . delenv ( key ) for ( k , v ) in env . items ( ) : monkeypatch . setenv ( k , v ) assert ( crashdialog . _get_environment_vars ( ) == expected )
test for crashdialog .