Skip to content

Commit f7c4cd0

Browse files
Consistently use raw strings for line-matching regexes (#180)
Fixes #176.
1 parent 2fa1a6f commit f7c4cd0

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

tests/test_subtests.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -394,19 +394,19 @@ def test_foo(self):
394394
if sys.version_info < (3, 11):
395395
result.stderr.re_match_lines(
396396
[
397-
"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=4\).*",
398-
"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=9\).*",
399-
"Ran 1 test in .*",
400-
"FAILED \(failures=6, skipped=4\)",
397+
r"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=4\).*",
398+
r"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=9\).*",
399+
r"Ran 1 test in .*",
400+
r"FAILED \(failures=6, skipped=4\)",
401401
]
402402
)
403403
else:
404404
result.stderr.re_match_lines(
405405
[
406-
"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=4\).*",
407-
"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=9\).*",
408-
"Ran 1 test in .*",
409-
"FAILED \(failures=6, skipped=4\)",
406+
r"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=4\).*",
407+
r"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=9\).*",
408+
r"Ran 1 test in .*",
409+
r"FAILED \(failures=6, skipped=4\)",
410410
]
411411
)
412412
elif runner == "pytest-normal":
@@ -418,11 +418,11 @@ def test_foo(self):
418418
r"test_skip_with_failure.py::T::test_foo \[custom message\] \(i=4\) SUBFAIL .*",
419419
r"test_skip_with_failure.py::T::test_foo \[custom message\] \(i=9\) SUBFAIL .*",
420420
"test_skip_with_failure.py::T::test_foo PASSED .*",
421-
"[custom message] (i=0) SUBSKIP [1] test_skip_with_failure.py:5: skip subtest i=0",
422-
"[custom message] (i=0) SUBSKIP [1] test_skip_with_failure.py:5: skip subtest i=3",
423-
"[custom message] (i=4) SUBFAIL test_skip_with_failure.py::T::test_foo - AssertionError: assert 4 < 4",
424-
"[custom message] (i=9) SUBFAIL test_skip_with_failure.py::T::test_foo - AssertionError: assert 9 < 4",
425-
".* 6 failed, 1 passed, 4 skipped in .*",
421+
r"[custom message] (i=0) SUBSKIP [1] test_skip_with_failure.py:5: skip subtest i=0",
422+
r"[custom message] (i=0) SUBSKIP [1] test_skip_with_failure.py:5: skip subtest i=3",
423+
r"[custom message] (i=4) SUBFAIL test_skip_with_failure.py::T::test_foo - AssertionError: assert 4 < 4",
424+
r"[custom message] (i=9) SUBFAIL test_skip_with_failure.py::T::test_foo - AssertionError: assert 9 < 4",
425+
r".* 6 failed, 1 passed, 4 skipped in .*",
426426
]
427427
)
428428
else:
@@ -463,19 +463,19 @@ def test_foo(self):
463463
if sys.version_info < (3, 11):
464464
result.stderr.re_match_lines(
465465
[
466-
"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=4\).*",
467-
"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=9\).*",
468-
"Ran 1 test in .*",
469-
"FAILED \(failures=6, skipped=5\)",
466+
r"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=4\).*",
467+
r"FAIL: test_foo \(__main__\.T\) \[custom message\] \(i=9\).*",
468+
r"Ran 1 test in .*",
469+
r"FAILED \(failures=6, skipped=5\)",
470470
]
471471
)
472472
else:
473473
result.stderr.re_match_lines(
474474
[
475-
"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=4\).*",
476-
"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=9\).*",
477-
"Ran 1 test in .*",
478-
"FAILED \(failures=6, skipped=5\)",
475+
r"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=4\).*",
476+
r"FAIL: test_foo \(__main__\.T\.test_foo\) \[custom message\] \(i=9\).*",
477+
r"Ran 1 test in .*",
478+
r"FAILED \(failures=6, skipped=5\)",
479479
]
480480
)
481481
elif runner == "pytest-normal":

0 commit comments

Comments
 (0)