Skip to content

Commit ee6506f

Browse files
committed
fix: specific files to include/omit should match even with relative files #1604.
1 parent 3344a78 commit ee6506f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ development at the same time, such as 4.5.x and 5.0.
2020
Unreleased
2121
----------
2222

23+
- Fix: with ``relative_files = true``, specifying a specific file to include or
24+
omit wouldn't work correctly (`issue 1604`_). This is now fixed, with
25+
testing help by `Marc Gibbons <pull 1608_>`_.
26+
2327
- Fix: the XML report would have an incorrect ``<source>`` element when using
2428
relative files and the source option ended with a slash (`issue 1541`_).
2529
This is now fixed, thanks to `Kevin Brown-Silva <pull 1608_>`_.
@@ -35,7 +39,9 @@ Unreleased
3539

3640
.. _issue 1523: https://github.com/nedbat/coveragepy/issues/1523
3741
.. _issue 1541: https://github.com/nedbat/coveragepy/issues/1541
42+
.. _issue 1604: https://github.com/nedbat/coveragepy/issues/1604
3843
.. _pull 1608: https://github.com/nedbat/coveragepy/pull/1608
44+
.. _pull 1609: https://github.com/nedbat/coveragepy/pull/1609
3945
.. _pull 1610: https://github.com/nedbat/coveragepy/pull/1610
4046
.. _pull 1613: https://github.com/nedbat/coveragepy/pull/1613
4147

coverage/files.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,8 @@ def prep_patterns(patterns: Iterable[str]) -> List[str]:
209209
"""
210210
prepped = []
211211
for p in patterns or []:
212-
if p.startswith(("*", "?")):
213-
prepped.append(p)
214-
else:
212+
prepped.append(p)
213+
if not p.startswith(("*", "?")):
215214
prepped.append(abs_file(p))
216215
return prepped
217216

0 commit comments

Comments
 (0)