@@ -46,7 +46,7 @@ def permission_error_tmpdir(tmp_path):
4646"""Fixture to test permissions errors in situations where they are not overcome."""
4747td = tmp_path / "testdir"
4848td .mkdir ()
49- (td / "x" ).write_bytes ( b"" )
49+ (td / "x" ).touch ( )
5050
5151# Set up PermissionError on Windows, where we can't delete read-only files.
5252 (td / "x" ).chmod (stat .S_IRUSR )
@@ -73,7 +73,7 @@ def test_deletes_nested_dir_with_files(self, tmp_path):
7373td / "s" / "y" ,
7474td / "s" / "z" ,
7575 ):
76- f .write_bytes ( b"" )
76+ f .touch ( )
7777
7878try :
7979rmtree (td )
@@ -95,7 +95,7 @@ def test_deletes_dir_with_readonly_files(self, tmp_path):
9595for d in td ,td / "sub" :
9696d .mkdir ()
9797for f in td / "x" ,td / "sub" / "y" :
98- f .write_bytes ( b"" )
98+ f .touch ( )
9999f .chmod (0 )
100100
101101try :
@@ -115,7 +115,7 @@ def test_avoids_changing_permissions_outside_tree(self, tmp_path):
115115
116116dir1 = tmp_path / "dir1"
117117dir1 .mkdir ()
118- (dir1 / "file" ).write_bytes ( b"" )
118+ (dir1 / "file" ).touch ( )
119119 (dir1 / "file" ).chmod (stat .S_IRUSR )
120120old_mode = (dir1 / "file" ).stat ().st_mode
121121
@@ -207,24 +207,28 @@ def _run_parse(name, value):
207207 )
208208return ast .literal_eval (output )
209209
210+ @pytest .mark .skipif (
211+ os .name != "nt" ,
212+ reason = "These environment variables are only used on Windows." ,
213+ )
210214@pytest .mark .parametrize (
211215"env_var_value, expected_truth_value" ,
212216 [
213- (None ,os . name == "nt" ),#True on Windows when the environment variable is unset.
217+ (None ,True ),#When the environment variable is unset.
214218 ("" ,False ),
215219 (" " ,False ),
216220 ("0" ,False ),
217- ("1" ,os . name == "nt" ),
221+ ("1" ,True ),
218222 ("false" ,False ),
219- ("true" ,os . name == "nt" ),
223+ ("true" ,True ),
220224 ("False" ,False ),
221- ("True" ,os . name == "nt" ),
225+ ("True" ,True ),
222226 ("no" ,False ),
223- ("yes" ,os . name == "nt" ),
227+ ("yes" ,True ),
224228 ("NO" ,False ),
225- ("YES" ,os . name == "nt" ),
229+ ("YES" ,True ),
226230 (" no " ,False ),
227- (" yes " ,os . name == "nt" ),
231+ (" yes " ,True ),
228232 ],
229233 )
230234@pytest .mark .parametrize (