summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2015-06-07 18:05:41 -0400
committerNed Batchelder <ned@nedbatchelder.com>2015-06-07 18:05:41 -0400
commite86cc37841d294cfc5dc7664b05a798b595967de (patch)
treee33ad44708752c43bab0fb673a508c1295425021
parent7092aa5e54c2c388960f223aabded527f3ccc324 (diff)
downloadpython-coveragepy-git-e86cc37841d294cfc5dc7664b05a798b595967de.tar.gz
Python 3.5 raises warnings about bad escapes in re.sub replacements, so escape them more.
-rw-r--r--tests/test_farm.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_farm.py b/tests/test_farm.py
index 92bd968a..d8d4c0fa 100644
--- a/tests/test_farm.py
+++ b/tests/test_farm.py
@@ -228,8 +228,8 @@ class FarmTestCase(object):
without triggering an assertion. `right_extra` means the right
directory can.
- `scrubs` is a list of pairs, regex find and replace patterns to use to
- scrub the files of unimportant differences.
+ `scrubs` is a list of pairs, regexes to find and literal strings to
+ replace them with to scrub the files of unimportant differences.
An assertion will be raised if the directories fail one of their
matches.
@@ -309,7 +309,7 @@ class FarmTestCase(object):
"""
for rgx_find, rgx_replace in scrubs:
- strdata = re.sub(rgx_find, rgx_replace, strdata)
+ strdata = re.sub(rgx_find, re.escape(rgx_replace), strdata)
return strdata
def contains(self, filename, *strlist):