summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-04-19 11:23:12 -0400
committerNed Batchelder <ned@nedbatchelder.com>2023-04-27 17:22:27 -0400
commitee6506f08e5de7e568751f78e8be82fc2a102ffe (patch)
treed658ad5b8cb17d52d0de9b634ce7af93a5f1ad7d
parent3344a78595f5158a7412b9a6c70ceb9a56df437b (diff)
downloadpython-coveragepy-git-ee6506f08e5de7e568751f78e8be82fc2a102ffe.tar.gz
fix: specific files to include/omit should match even with relative files #1604.
-rw-r--r--CHANGES.rst6
-rw-r--r--coverage/files.py5
2 files changed, 8 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index a001a9e6..377cabc1 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Fix: with ``relative_files = true``, specifying a specific file to include or
+ omit wouldn't work correctly (`issue 1604`_). This is now fixed, with
+ testing help by `Marc Gibbons <pull 1608_>`_.
+
- Fix: the XML report would have an incorrect ``<source>`` element when using
relative files and the source option ended with a slash (`issue 1541`_).
This is now fixed, thanks to `Kevin Brown-Silva <pull 1608_>`_.
@@ -35,7 +39,9 @@ Unreleased
.. _issue 1523: https://github.com/nedbat/coveragepy/issues/1523
.. _issue 1541: https://github.com/nedbat/coveragepy/issues/1541
+.. _issue 1604: https://github.com/nedbat/coveragepy/issues/1604
.. _pull 1608: https://github.com/nedbat/coveragepy/pull/1608
+.. _pull 1609: https://github.com/nedbat/coveragepy/pull/1609
.. _pull 1610: https://github.com/nedbat/coveragepy/pull/1610
.. _pull 1613: https://github.com/nedbat/coveragepy/pull/1613
diff --git a/coverage/files.py b/coverage/files.py
index 2a117734..925d5772 100644
--- a/coverage/files.py
+++ b/coverage/files.py
@@ -209,9 +209,8 @@ def prep_patterns(patterns: Iterable[str]) -> List[str]:
"""
prepped = []
for p in patterns or []:
- if p.startswith(("*", "?")):
- prepped.append(p)
- else:
+ prepped.append(p)
+ if not p.startswith(("*", "?")):
prepped.append(abs_file(p))
return prepped