From 9020d5d7187a33e37fad7dff87b7ec78eacde7b6 Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Mon, 23 Sep 2024 10:45:30 +1200 Subject: [PATCH] Properly mock the environment. --- test/test_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_model.py b/test/test_model.py index 0eadd4d2c..827786fcd 100644 --- a/test/test_model.py +++ b/test/test_model.py @@ -3242,7 +3242,7 @@ def test_relation_remote_app_name_env(self, monkeypatch: pytest.MonkeyPatch): monkeypatch.setenv('JUJU_RELATION_ID', 'x:5') monkeypatch.setenv('JUJU_REMOTE_APP', 'remoteapp1') assert self.backend.relation_remote_app_name(5) == 'remoteapp1' - os.environ['JUJU_RELATION_ID'] = '5' + monkeypatch.setenv('JUJU_RELATION_ID', '5') assert self.backend.relation_remote_app_name(5) == 'remoteapp1' def test_relation_remote_app_name_script_success( @@ -3266,7 +3266,7 @@ def test_relation_remote_app_name_script_success( # JUJU_RELATION_ID unset but JUJU_REMOTE_APP set monkeypatch.delenv('JUJU_RELATION_ID') - os.environ['JUJU_REMOTE_APP'] = 'remoteapp1' + monkeypatch.setenv('JUJU_REMOTE_APP', 'remoteapp1') assert self.backend.relation_remote_app_name(5) == 'remoteapp2' # Both set, but JUJU_RELATION_ID a different relation