1010
1111from tests .utils import pushd , run_command , IS_WINDOWS
1212
13- # Use appropriate command for the platform
14- if IS_WINDOWS :
15- printenv_cmd = ["dotenv" , "run" , "cmd" , "/c" , "echo" , "%a%" ]
16- else :
17- printenv_cmd = ["dotenv" , "run" , "printenv" , "a" ]
18-
1913
2014@pytest .mark .parametrize (
2115 "format,content,expected" ,
@@ -190,6 +184,12 @@ def test_get_default_path(tmp_path):
190184def test_run (tmp_path ):
191185 with pushd (tmp_path ):
192186 (tmp_path / ".env" ).write_text ("a=b" )
187+
188+ if IS_WINDOWS :
189+ printenv_cmd = ["dotenv" , "run" , "cmd" , "/c" , "echo" , "%a%" ]
190+ else :
191+ printenv_cmd = ["dotenv" , "run" , "printenv" , "a" ]
192+
193193 result = run_command (printenv_cmd )
194194 assert result == "b\n "
195195
@@ -200,6 +200,11 @@ def test_run_with_existing_variable(tmp_path):
200200 env = dict (os .environ )
201201 env .update ({"LANG" : "en_US.UTF-8" , "a" : "c" })
202202
203+ if IS_WINDOWS :
204+ printenv_cmd = ["dotenv" , "run" , "cmd" , "/c" , "echo" , "%a%" ]
205+ else :
206+ printenv_cmd = ["dotenv" , "run" , "printenv" , "a" ]
207+
203208 result = run_command (printenv_cmd , env = env )
204209
205210 assert result == "b\n "
@@ -211,6 +216,20 @@ def test_run_with_existing_variable_not_overridden(tmp_path):
211216 env = dict (os .environ )
212217 env .update ({"LANG" : "en_US.UTF-8" , "a" : "c" })
213218
219+ # Use appropriate command for the platform
220+ if IS_WINDOWS :
221+ printenv_cmd = [
222+ "dotenv" ,
223+ "run" ,
224+ "--no-override" ,
225+ "cmd" ,
226+ "/c" ,
227+ "echo" ,
228+ "%a%" ,
229+ ]
230+ else :
231+ printenv_cmd = ["dotenv" , "run" , "--no-override" , "printenv" , "a" ]
232+
214233 result = run_command (printenv_cmd , env = env )
215234
216235 assert result == "c\n "
0 commit comments