Skip to content

Commit 79e1d7d

Browse files
committed
Fix invalid escape sequences
1 parent 8aa0671 commit 79e1d7d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

testing/test_pytest_html.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def run(testdir, path='report.html', *args):
2929
def assert_results_by_outcome(html, test_outcome, test_outcome_number,
3030
label=None):
3131
# Asserts if the test number of this outcome in the summary is correct
32-
regex_summary = '(\d)+ {0}'.format(label or test_outcome)
32+
regex_summary = r'(\d)+ {0}'.format(label or test_outcome)
3333
assert int(re.search(regex_summary, html).group(1)) == test_outcome_number
3434

3535
# Asserts if the generated checkbox of this outcome is correct
@@ -47,12 +47,12 @@ def assert_results_by_outcome(html, test_outcome, test_outcome_number,
4747
def assert_results(html, tests=1, duration=None, passed=1, skipped=0, failed=0,
4848
errors=0, xfailed=0, xpassed=0, rerun=0):
4949
# Asserts total amount of tests
50-
total_tests = re.search('(\d)+ tests ran', html)
50+
total_tests = re.search(r'(\d)+ tests ran', html)
5151
assert int(total_tests.group(1)) == tests
5252

5353
# Asserts tests running duration
5454
if duration is not None:
55-
tests_duration = re.search('([\d,.]+) seconds', html)
55+
tests_duration = re.search(r'([\d,.]+) seconds', html)
5656
assert float(tests_duration.group(1)) >= float(duration)
5757

5858
# Asserts by outcome
@@ -76,7 +76,7 @@ def test_sleep():
7676
result, html = run(testdir)
7777
assert result.ret == 0
7878
assert_results(html, duration=sleep)
79-
p = re.compile('<td class="col-duration">([\d,.]+)</td>')
79+
p = re.compile(r'<td class="col-duration">([\d,.]+)</td>')
8080
m = p.search(html)
8181
assert float(m.group(1)) >= sleep
8282

@@ -531,7 +531,7 @@ def test_environment_list_value(self, testdir):
531531
content = tuple(str(random.random()) for i in range(10))
532532
content += tuple(random.random() for i in range(10))
533533
expected_content = ', '.join((str(i) for i in content))
534-
expected_html_re = '<td>content</td>\n\s+<td>{}</td>'.format(
534+
expected_html_re = r'<td>content</td>\n\s+<td>{}</td>'.format(
535535
expected_content
536536
)
537537
testdir.makeconftest("""

0 commit comments

Comments
 (0)