trying to fix tests
This commit is contained in:
parent
54d4f4f48b
commit
044c0a0c4f
@ -81,7 +81,22 @@ class TestParseFatalStacktrace:
|
|||||||
assert (typ, func) == ('', '')
|
assert (typ, func) == ('', '')
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('env, expected', [
|
class TestCrashDialog:
|
||||||
|
|
||||||
|
"""Tests for crashdialog."""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setup_class(cls):
|
||||||
|
"""Clear env."""
|
||||||
|
cls.env = os.environ.copy()
|
||||||
|
os.environ = {}
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def teardown_class(cls):
|
||||||
|
"""Restore env."""
|
||||||
|
os.environ = cls.env.copy()
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('env, expected', [
|
||||||
({'FOO': 'bar'}, ""),
|
({'FOO': 'bar'}, ""),
|
||||||
({'FOO': 'bar', 'LC_ALL': 'baz'}, "LC_ALL = baz"),
|
({'FOO': 'bar', 'LC_ALL': 'baz'}, "LC_ALL = baz"),
|
||||||
({'LC_ALL': 'baz', 'PYTHONFOO': 'fish'}, "LC_ALL = baz\nPYTHONFOO = fish"),
|
({'LC_ALL': 'baz', 'PYTHONFOO': 'fish'}, "LC_ALL = baz\nPYTHONFOO = fish"),
|
||||||
@ -94,10 +109,9 @@ class TestParseFatalStacktrace:
|
|||||||
"QT_IM_MODULE = fcitx"
|
"QT_IM_MODULE = fcitx"
|
||||||
),
|
),
|
||||||
({'LANGUAGE': 'foo', 'LANG': 'en_US.UTF-8'}, "LANG = en_US.UTF-8"),
|
({'LANGUAGE': 'foo', 'LANG': 'en_US.UTF-8'}, "LANG = en_US.UTF-8"),
|
||||||
])
|
])
|
||||||
def test_get_environment_vars(monkeypatch, env, expected):
|
def test_get_environment_vars(self, monkeypatch, env, expected):
|
||||||
"""Test for crashdialog._get_environment_vars."""
|
"""Test for crashdialog._get_environment_vars."""
|
||||||
os.environ = {}
|
|
||||||
for k, v in env.items():
|
for k, v in env.items():
|
||||||
monkeypatch.setenv(k, v)
|
monkeypatch.setenv(k, v)
|
||||||
assert crashdialog._get_environment_vars() == expected
|
assert crashdialog._get_environment_vars() == expected
|
||||||
|
Loading…
Reference in New Issue
Block a user