diff --git a/tests/test_cli.py b/tests/test_cli.py index b21725ca..61f0627b 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +import os + import pytest import sh @@ -144,7 +146,9 @@ def test_run_with_existing_variable(tmp_path): with open(dotenv_file, "w") as f: f.write("a=b") - result = sh.dotenv("run", "printenv", "a", _env={"LANG": "en_US.UTF-8", "a": "c"}) + test_env = dict(os.environ) + test_env.update({"LANG": "en_US.UTF-8", "a": "c"}) + result = sh.dotenv("run", "printenv", "a", _env=test_env) assert result == "b\n" @@ -155,12 +159,14 @@ def test_run_with_existing_variable_not_overridden(tmp_path): with open(dotenv_file, "w") as f: f.write("a=b") + test_env = dict(os.environ) + test_env.update({"LANG": "en_US.UTF-8", "a": "c"}) result = sh.dotenv( "run", "--no-override", "printenv", "a", - _env={"LANG": "en_US.UTF-8", "a": "c"}, + _env=test_env, ) assert result == "c\n"