From 7a5942e04ac8af6997a33db46064e1fffe110bee Mon Sep 17 00:00:00 2001 From: Jorge Cardona Date: Tue, 19 Apr 2022 16:03:16 +0200 Subject: [PATCH] Use monkeypatch.setenv instead of copying the os.environ for tests. --- guake/tests/test_about.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/guake/tests/test_about.py b/guake/tests/test_about.py index d577b6bd6..b8f14049d 100644 --- a/guake/tests/test_about.py +++ b/guake/tests/test_about.py @@ -9,15 +9,10 @@ @pytest.fixture -def dialog(mocker): +def dialog(mocker, monkeypatch): mocker.patch("guake.simplegladeapp.Gtk.Widget.show_all") - try: - old_os_environ = os.environ - os.environ["LANGUAGE"] = "en_US.UTF-8" - ad = AboutDialog() - yield ad - finally: - os.environ = old_os_environ + monkeypatch.setenv("LANGUAGE", "en_US.UTF-8") + yield AboutDialog() def test_version_test(dialog):