diff options
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | coverage/config.py | 6 | ||||
-rw-r--r-- | tests/test_arcs.py | 6 | ||||
-rw-r--r-- | tests/test_coverage.py | 4 |
4 files changed, 14 insertions, 6 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 206fbf35..6d17267b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -38,10 +38,14 @@ Latest - A module run with ``-m`` can be used as the argument to ``--source``, fixing `issue 328`_. Thanks, Buck Evan. +- The regex for matching exclusion pragmas has been fixed to allow more kinds + of whitespace, fixing `issue 334`_. + - Made some PyPy-specific tweaks to improve speed under PyPy. Thanks, Alex Gaynor. .. _issue 328: https://bitbucket.org/ned/coveragepy/issue/328/misbehavior-in-run-source +.. _issue 334: https://bitbucket.org/ned/coveragepy/issue/334/pragma-not-recognized-if-tab-character .. _issue 342: https://bitbucket.org/ned/coveragepy/issue/342/console-and-html-coverage-reports-differ .. _issue 343: https://bitbucket.org/ned/coveragepy/issue/343/an-explicitly-named-non-existent-config diff --git a/coverage/config.py b/coverage/config.py index 65f4222a..9bd5dd5f 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -108,14 +108,14 @@ class HandyConfigParser(configparser.RawConfigParser): return list(filter(None, value_list.split('\n'))) -# The default line exclusion regexes +# The default line exclusion regexes. DEFAULT_EXCLUDE = [ - '(?i)# *pragma[: ]*no *cover', + r'(?i)#\s*pragma[:\s]?\s*no\s*cover', ] # The default partial branch regexes, to be modified by the user. DEFAULT_PARTIAL = [ - '(?i)# *pragma[: ]*no *branch', + r'(?i)#\s*pragma[:\s]?\s*no\s*branch', ] # The default partial branch regexes, based on Python semantics. diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 80923f8d..3856a2cf 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -587,9 +587,11 @@ class ExcludeTest(CoverageTest): if c: # pragma NOBRANCH d = 6 e = 7 + if e:#\tpragma:\tno branch + f = 9 """, - [1,2,3,4,5,6,7], - arcz=".1 12 23 24 34 45 56 57 67 7.", arcz_missing="") + [1,2,3,4,5,6,7,8,9], + arcz=".1 12 23 24 34 45 56 57 67 78 89 9. 8.", arcz_missing="") def test_custom_pragmas(self): self.check_coverage("""\ diff --git a/tests/test_coverage.py b/tests/test_coverage.py index 565fa4e1..b69fd986 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -1113,8 +1113,10 @@ class ExcludeTest(CoverageTest): c = 3 d = 4 #pragma NOCOVER e = 5 + f = 6#\tpragma:\tno cover + g = 7 """, - [1,3,5] + [1,3,5,7] ) def test_simple(self): |