Commit a79f0e50 authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

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: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
parent dcfe55f1
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment