mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
tests/gclient_scm_test.py: Fix invalid escape sequences in regex strings
Note that on line 504 I also fixed the test on windows by allowing \. Also properly escaped /.
Errors:
C:\Google\depot_tools\tests\gclient_scm_test.py:42: SyntaxWarning: invalid escape sequence \[
TIMESTAMP_RE = re.compile('\[[0-9]{1,2}:[0-9]{2}:[0-9]{2}\] (.*)', re.DOTALL)
C:\Google\depot_tools\tests\gclient_scm_test.py:504: SyntaxWarning: invalid escape sequence \.
"breaking lock.*\.git/index\.lock")
Bug: 958138
Change-Id: I19ef98538a1c172d7139ca2d7097a7fbc33ebe80
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1815866
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
This commit is contained in:
@@ -39,7 +39,7 @@ git_cache.Mirror.SetCachePath(None)
|
||||
# Shortcut since this function is used often
|
||||
join = gclient_scm.os.path.join
|
||||
|
||||
TIMESTAMP_RE = re.compile('\[[0-9]{1,2}:[0-9]{2}:[0-9]{2}\] (.*)', re.DOTALL)
|
||||
TIMESTAMP_RE = re.compile(r'\[[0-9]{1,2}:[0-9]{2}:[0-9]{2}\] (.*)', re.DOTALL)
|
||||
def strip_timestamps(value):
|
||||
lines = value.splitlines(True)
|
||||
for i in range(len(lines)):
|
||||
@@ -501,7 +501,7 @@ class ManagedGitWrapperTestCase(BaseGitWrapperTestCase):
|
||||
pass
|
||||
scm.update(options, (), [])
|
||||
self.assertRegexpMatches(sys.stdout.getvalue(),
|
||||
"breaking lock.*\.git/index\.lock")
|
||||
r'breaking lock.*\.git[/|\\]index\.lock')
|
||||
self.assertFalse(os.path.exists(file_path))
|
||||
sys.stdout.close()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user