summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-11-27 08:43:14 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-11-27 08:43:14 -0500
commit92d02ded76ebc769dd555e5e3db6f932b8b60a83 (patch)
tree0a450a68a8d0de0170dd7b8b3b4a8f38407f315d
parent76a06f5319730da58f888ae368b25439319cc6b0 (diff)
downloadpython-coveragepy-92d02ded76ebc769dd555e5e3db6f932b8b60a83.tar.gz
Avoid flags in regexes we combine
These regexes get piped together with other regexes, and flags not at the beginning of the regex raise DeprecationWarnings. Also, I'm not sure what the flag will do when combined with the other regexes. Also also, do people really use upper-case pragmas?
-rw-r--r--CHANGES.rst3
-rw-r--r--coverage/config.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index adbe7d6..90fc845 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -48,6 +48,9 @@ Unreleased
- Fixed an unusual bug involving multiple coding declarations affecting code
containing code in multi-line strings: `issue 529`_.
+- The default pragma regex changed slightly, but this will only matter to you if
+ you are deranged and use mixed-case pragmas.
+
- Deal properly with non-ASCII file names in an ASCII-only world, `issue 533`_.
- Prevented deprecation warnings from configparser that happened in some
diff --git a/coverage/config.py b/coverage/config.py
index 6750b79..ad3efa9 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -122,12 +122,12 @@ class HandyConfigParser(configparser.RawConfigParser):
# The default line exclusion regexes.
DEFAULT_EXCLUDE = [
- r'(?i)#\s*pragma[:\s]?\s*no\s*cover',
+ r'#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(cover|COVER)',
]
# The default partial branch regexes, to be modified by the user.
DEFAULT_PARTIAL = [
- r'(?i)#\s*pragma[:\s]?\s*no\s*branch',
+ r'#\s*(pragma|PRAGMA)[:\s]?\s*(no|NO)\s*(branch|BRANCH)',
]
# The default partial branch regexes, based on Python semantics.