Skip to content

Commit

Permalink
fix: specific files to include/omit should match even with relative f…
Browse files Browse the repository at this point in the history
…iles #1604.
  • Loading branch information
nedbat committed Apr 27, 2023
1 parent 3344a78 commit ee6506f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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_>`_.
Expand All @@ -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

Expand Down
5 changes: 2 additions & 3 deletions coverage/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit ee6506f

Please sign in to comment.