@@ -46,7 +46,7 @@ def permission_error_tmpdir(tmp_path):
46
46
"""Fixture to test permissions errors in situations where they are not overcome."""
47
47
td = tmp_path / "testdir"
48
48
td .mkdir ()
49
- (td / "x" ).write_bytes ( b"" )
49
+ (td / "x" ).touch ( )
50
50
51
51
# Set up PermissionError on Windows, where we can't delete read-only files.
52
52
(td / "x" ).chmod (stat .S_IRUSR )
@@ -73,7 +73,7 @@ def test_deletes_nested_dir_with_files(self, tmp_path):
73
73
td / "s" / "y" ,
74
74
td / "s" / "z" ,
75
75
):
76
- f .write_bytes ( b"" )
76
+ f .touch ( )
77
77
78
78
try :
79
79
rmtree (td )
@@ -95,7 +95,7 @@ def test_deletes_dir_with_readonly_files(self, tmp_path):
95
95
for d in td , td / "sub" :
96
96
d .mkdir ()
97
97
for f in td / "x" , td / "sub" / "y" :
98
- f .write_bytes ( b"" )
98
+ f .touch ( )
99
99
f .chmod (0 )
100
100
101
101
try :
@@ -115,7 +115,7 @@ def test_avoids_changing_permissions_outside_tree(self, tmp_path):
115
115
116
116
dir1 = tmp_path / "dir1"
117
117
dir1 .mkdir ()
118
- (dir1 / "file" ).write_bytes ( b"" )
118
+ (dir1 / "file" ).touch ( )
119
119
(dir1 / "file" ).chmod (stat .S_IRUSR )
120
120
old_mode = (dir1 / "file" ).stat ().st_mode
121
121
@@ -207,24 +207,28 @@ def _run_parse(name, value):
207
207
)
208
208
return ast .literal_eval (output )
209
209
210
+ @pytest .mark .skipif (
211
+ os .name != "nt" ,
212
+ reason = "These environment variables are only used on Windows." ,
213
+ )
210
214
@pytest .mark .parametrize (
211
215
"env_var_value, expected_truth_value" ,
212
216
[
213
- (None , os . name == "nt" ), # True on Windows when the environment variable is unset.
217
+ (None , True ), # When the environment variable is unset.
214
218
("" , False ),
215
219
(" " , False ),
216
220
("0" , False ),
217
- ("1" , os . name == "nt" ),
221
+ ("1" , True ),
218
222
("false" , False ),
219
- ("true" , os . name == "nt" ),
223
+ ("true" , True ),
220
224
("False" , False ),
221
- ("True" , os . name == "nt" ),
225
+ ("True" , True ),
222
226
("no" , False ),
223
- ("yes" , os . name == "nt" ),
227
+ ("yes" , True ),
224
228
("NO" , False ),
225
- ("YES" , os . name == "nt" ),
229
+ ("YES" , True ),
226
230
(" no " , False ),
227
- (" yes " , os . name == "nt" ),
231
+ (" yes " , True ),
228
232
],
229
233
)
230
234
@pytest .mark .parametrize (
0 commit comments