fix(python): fix invalid escape sequences

This commit is contained in:
Eisuke Kawashima 2025-06-09 10:10:19 +09:00 committed by Chris Thrasher
parent 04cbcfa1d1
commit ceed26842b
3 changed files with 6 additions and 6 deletions

View File

@ -17,7 +17,7 @@ from typing import List
TestInfo = namedtuple('TestInfo', ['name', 'tags']) TestInfo = namedtuple('TestInfo', ['name', 'tags'])
cmake_version_regex = re.compile('cmake version (\d+)\.(\d+)\.(\d+)') cmake_version_regex = re.compile(r'cmake version (\d+)\.(\d+)\.(\d+)')
def get_cmake_version(): def get_cmake_version():
result = subprocess.run(['cmake', '--version'], result = subprocess.run(['cmake', '--version'],

View File

@ -121,7 +121,7 @@ def filterLine(line, isCompact):
# strip source line numbers # strip source line numbers
# Note that this parser assumes an already normalized filepath from above, # Note that this parser assumes an already normalized filepath from above,
# and might break terribly if it is moved around before the normalization. # and might break terribly if it is moved around before the normalization.
line = filelocParser.sub('\g<filename>:<line number>', line) line = filelocParser.sub(r'\g<filename>:<line number>', line)
line = lineNumberParser.sub(" ", line) line = lineNumberParser.sub(" ", line)
@ -130,7 +130,7 @@ def filterLine(line, isCompact):
line = line.replace(': PASSED', ': passed') line = line.replace(': PASSED', ': passed')
# strip out the test order number in TAP to avoid massive diffs for every change # strip out the test order number in TAP to avoid massive diffs for every change
line = tapTestNumParser.sub("\g<1> {test-number} -", line) line = tapTestNumParser.sub(r"\g<1> {test-number} -", line)
# strip Catch2 version number # strip Catch2 version number
line = versionParser.sub("<version>", line) line = versionParser.sub("<version>", line)
@ -148,7 +148,7 @@ def filterLine(line, isCompact):
line = junitDurationsParser.sub(' time="{duration}"', line) line = junitDurationsParser.sub(' time="{duration}"', line)
line = durationParser.sub(' duration="{duration}"', line) line = durationParser.sub(' duration="{duration}"', line)
line = timestampsParser.sub('{iso8601-timestamp}', line) line = timestampsParser.sub('{iso8601-timestamp}', line)
line = specialCaseParser.sub('file:\g<1>', line) line = specialCaseParser.sub(r'file:\g<1>', line)
line = sinceEpochParser.sub('{since-epoch-report}', line) line = sinceEpochParser.sub('{since-epoch-report}', line)
return line return line

View File

@ -21,11 +21,11 @@ import os
import re import re
def normalized_path(path): def normalized_path(path):
"""Replaces \ in paths on Windows with /""" r"""Replaces \ in paths on Windows with /"""
return path.replace('\\', '/') return path.replace('\\', '/')
def normalized_paths(paths): def normalized_paths(paths):
"""Replaces \ with / in every path""" r"""Replaces \ with / in every path"""
return [normalized_path(path) for path in paths] return [normalized_path(path) for path in paths]
source_path = catchPath + '/src/catch2' source_path = catchPath + '/src/catch2'