@@ -65,7 +65,6 @@ def parse_test_case(case: DataDrivenTestCase) -> None:
65
65
join = posixpath .join
66
66
67
67
out_section_missing = case .suite .required_out_section
68
- normalize_output = True
69
68
70
69
files : list [tuple [str , str ]] = [] # path and contents
71
70
output_files : list [tuple [str , str | Pattern [str ]]] = [] # output path and contents
@@ -156,8 +155,6 @@ def _item_fail(msg: str) -> NoReturn:
156
155
157
156
version_check = True
158
157
for arg in args :
159
- if arg == "skip-path-normalization" :
160
- normalize_output = False
161
158
if arg .startswith ("version" ):
162
159
compare_op = arg [7 :9 ]
163
160
if compare_op not in {">=" , "==" }:
@@ -185,7 +182,7 @@ def _item_fail(msg: str) -> NoReturn:
185
182
version_check = sys .version_info [: len (version )] == version
186
183
if version_check :
187
184
tmp_output = [expand_variables (line ) for line in item .data ]
188
- if os .path .sep == "\\ " and normalize_output :
185
+ if os .path .sep == "\\ " and case . normalize_output :
189
186
tmp_output = [fix_win_path (line ) for line in tmp_output ]
190
187
if item .id == "out" or item .id == "out1" :
191
188
output = tmp_output
@@ -239,7 +236,6 @@ def _item_fail(msg: str) -> NoReturn:
239
236
case .expected_rechecked_modules = rechecked_modules
240
237
case .deleted_paths = deleted_paths
241
238
case .triggered = triggered or []
242
- case .normalize_output = normalize_output
243
239
case .expected_fine_grained_targets = targets
244
240
case .test_modules = test_modules
245
241
@@ -269,7 +265,7 @@ class DataDrivenTestCase(pytest.Item):
269
265
270
266
# Whether or not we should normalize the output to standardize things like
271
267
# forward vs backward slashes in file paths for Windows vs Linux.
272
- normalize_output = True
268
+ normalize_output : bool
273
269
274
270
# Extra attributes used by some tests.
275
271
last_line : int
@@ -281,10 +277,12 @@ def __init__(
281
277
self ,
282
278
parent : DataSuiteCollector ,
283
279
suite : DataSuite ,
280
+ * ,
284
281
file : str ,
285
282
name : str ,
286
283
writescache : bool ,
287
284
only_when : str ,
285
+ normalize_output : bool ,
288
286
platform : str | None ,
289
287
skip : bool ,
290
288
xfail : bool ,
@@ -296,6 +294,7 @@ def __init__(
296
294
self .file = file
297
295
self .writescache = writescache
298
296
self .only_when = only_when
297
+ self .normalize_output = normalize_output
299
298
if (platform == "windows" and sys .platform != "win32" ) or (
300
299
platform == "posix" and sys .platform == "win32"
301
300
):
@@ -651,6 +650,7 @@ def pytest_pycollect_makeitem(collector: Any, name: str, obj: object) -> Any | N
651
650
r"(?P<name>[a-zA-Z_0-9]+)"
652
651
r"(?P<writescache>-writescache)?"
653
652
r"(?P<only_when>-only_when_cache|-only_when_nocache)?"
653
+ r"(?P<skip_path_normalization>-skip_path_normalization)?"
654
654
r"(-(?P<platform>posix|windows))?"
655
655
r"(?P<skip>-skip)?"
656
656
r"(?P<xfail>-xfail)?"
@@ -694,6 +694,7 @@ def split_test_cases(
694
694
platform = m .group ("platform" ),
695
695
skip = bool (m .group ("skip" )),
696
696
xfail = bool (m .group ("xfail" )),
697
+ normalize_output = not m .group ("skip_path_normalization" ),
697
698
data = data ,
698
699
line = line_no ,
699
700
)
0 commit comments