diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 60e8d0a29..ab0c1142a 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -178,7 +178,7 @@ jobs:
echo "sha10=$SHA10" >> $GITHUB_ENV
echo "slug=$SLUG" >> $GITHUB_ENV
echo "report_dir=$REPORT_DIR" >> $GITHUB_ENV
- echo "url=https://nedbat.github.io/coverage-reports/$REPORT_DIR" >> $GITHUB_ENV
+ echo "url=https://htmlpreview.github.io/?https://github.com/nedbat/coverage-reports/blob/main/reports/$SLUG/htmlcov/index.html" >> $GITHUB_ENV
echo "branch=${REF#refs/heads/}" >> $GITHUB_ENV
- name: "Summarize"
@@ -217,6 +217,8 @@ jobs:
# Make the commit message.
echo "${{ env.total }}% - $COMMIT_MESSAGE" > commit.txt
echo "" >> commit.txt
+ echo "[View the report](${{ env.url }})" >> commit.txt
+ echo "" >> commit.txt
echo "${{ env.url }}" >> commit.txt
echo "${{ env.sha10 }}: ${{ env.branch }}" >> commit.txt
# Commit.
diff --git a/CHANGES.rst b/CHANGES.rst
index 937835ccc..22ff98dfd 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -19,6 +19,39 @@ development at the same time, such as 4.5.x and 5.0.
.. scriv-start-here
+.. _changes_7-2-4:
+
+Version 7.2.4 — 2023-04-28
+--------------------------
+
+PyCon 2023 sprint fixes!
+
+- 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 `_.
+
+- Fix: the XML report would have an incorrect ```` element when using
+ relative files and the source option ended with a slash (`issue 1541`_).
+ This is now fixed, thanks to `Kevin Brown-Silva `_.
+
+- When the HTML report location is printed to the terminal, it's now a
+ terminal-compatible URL, so that you can click the location to open the HTML
+ file in your browser. Finishes `issue 1523`_ thanks to `Ricardo Newbery
+ `_.
+
+- Docs: a new :ref:`Migrating page ` with details about how to
+ migrate between major versions of coverage.py. It currently covers the
+ wildcard changes in 7.x. Thanks, `Brian Grohe `_.
+
+.. _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
+
+
.. _changes_7-2-3:
Version 7.2.3 — 2023-04-06
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 0ba35f628..f03ceacbc 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -23,6 +23,7 @@ Aron Griffis
Artem Dayneko
Arthur Deygin
Arthur Rio
+Asher Foa
Ben Carlsson
Ben Finney
Benjamin Parzella
@@ -32,8 +33,11 @@ Bill Hart
Bradley Burns
Brandon Rhodes
Brett Cannon
+Brian Grohe
+Bruno Oliveira
Bruno P. Kinoshita
Buck Evan
+Buck Golemon
Calen Pennington
Carl Friedrich Bolz-Tereick
Carl Gieringer
@@ -42,10 +46,12 @@ Chris Adams
Chris Jerdonek
Chris Rose
Chris Warrick
+Christian Clauss
Christian Heimes
Christine Lytwynec
Christoph Blessing
Christoph Zwerschke
+Christopher Pickering
Clément Pit-Claudel
Conrad Ho
Cosimo Lupo
@@ -59,6 +65,7 @@ David Christian
David MacIver
David Stanek
David Szotten
+Dennis Sweeney
Detlev Offenbach
Devin Jeanpierre
Dirk Thomas
@@ -79,6 +86,7 @@ George-Cristian Bîrzan
Greg Rogers
Guido van Rossum
Guillaume Chazarain
+Holger Krekel
Hugo van Kemenade
Ian Moore
Ilia Meerovich
@@ -87,10 +95,13 @@ Ionel Cristian Mărieș
Ivan Ciuvalschii
J. M. F. Tsang
JT Olds
+Jakub Wilk
+Janakarajan Natarajan
Jerin Peter George
Jessamyn Smith
Joe Doherty
Joe Jevnik
+John Vandenberg
Jon Chappell
Jon Dufresne
Joseph Tate
@@ -99,21 +110,29 @@ Judson Neer
Julian Berman
Julien Voisin
Justas Sadzevičius
+Karthikeyan Singaravelan
Kassandra Keeton
+Kevin Brown-Silva
Kjell Braden
Krystian Kichewko
Kyle Altendorf
Lars Hupfeldt Nielsen
+Latrice Wilgus
Leonardo Pistone
Lewis Gaul
Lex Berezhny
Loïc Dachary
Lorenzo Micò
+Louis Heredero
+Luis Nell
+Łukasz Stolcman
Manuel Jacob
Marc Abramowitz
+Marc Gibbons
Marc Legendre
Marcelo Trylesinski
Marcus Cobden
+Mariatta
Marius Gedminas
Mark van der Wal
Martin Fuzzey
@@ -123,41 +142,53 @@ Matthew Boehm
Matthew Desmarais
Matus Valo
Max Linke
+Mayank Singhal
Michael Krebs
Michał Bultrowicz
Michał Górny
Mickie Betz
Mike Fiedler
+Min ho Kim
Nathan Land
+Naveen Srinivasan
Naveen Yadav
Neil Pilgrim
+Nicholas Nadeau
Nikita Bloshchanevich
+Nikita Sobolev
Nils Kattenbeck
Noel O'Boyle
+Oleg Höfling
Oleh Krehel
Olivier Grisel
Ori Avtalion
Pablo Carballo
Pankaj Pandey
Patrick Mezard
+Pavel Tsialnou
Peter Baughman
Peter Ebden
Peter Portante
Phebe Polk
Reya B
+Ricardo Newbery
Rodrigue Cloutier
Roger Hu
+Roland Illig
Ross Lawley
Roy Williams
Russell Keith-Magee
+S. Y. Lee
Salvatore Zagaria
Sandra Martocchia
Scott Belden
Sebastián Ramírez
Sergey B Kirpichev
+Shantanu
Sigve Tjora
Simon Willison
Stan Hu
+Stanisław Pitucha
Stefan Behnel
Stephan Deibel
Stephan Richter
@@ -167,15 +198,17 @@ Steve Leonard
Steve Oswald
Steve Peak
Sviatoslav Sydorenko
-S. Y. Lee
Teake Nutma
Ted Wexler
Thijs Triemstra
Thomas Grainger
+Timo Furrer
Titus Brown
+Tom Gurion
Valentin Lab
Ville Skyttä
Vince Salvino
+Wonwin McBrootles
Xie Yanbo
Yilei "Dolee" Yang
Yury Selivanov
diff --git a/Makefile b/Makefile
index f82f2ee27..847e50987 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ clean_platform:
clean: clean_platform ## Remove artifacts of test execution, installation, etc.
@echo "Cleaning..."
@-pip uninstall -yq coverage
+ @mkdir -p build # so the chmod won't fail if build doesn't exist
@chmod -R 777 build
@rm -rf build coverage.egg-info dist htmlcov
@rm -f *.bak */*.bak */*/*.bak */*/*/*.bak */*/*/*/*.bak */*/*/*/*/*.bak
diff --git a/coverage/files.py b/coverage/files.py
index 2a1177340..925d57723 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
diff --git a/coverage/html.py b/coverage/html.py
index 570760604..f11d85e1a 100644
--- a/coverage/html.py
+++ b/coverage/html.py
@@ -22,7 +22,7 @@
from coverage.exceptions import NoDataError
from coverage.files import flat_rootname
from coverage.misc import ensure_dir, file_be_gone, Hasher, isolate_module, format_local_datetime
-from coverage.misc import human_sorted, plural
+from coverage.misc import human_sorted, plural, stdout_link
from coverage.report import get_analysis_to_report
from coverage.results import Analysis, Numbers
from coverage.templite import Templite
@@ -493,7 +493,9 @@ def index_file(self, first_html: str, final_html: str) -> None:
index_file = os.path.join(self.directory, "index.html")
write_html(index_file, html)
- self.coverage._message(f"Wrote HTML report to {index_file}")
+
+ print_href = stdout_link(index_file, f"file://{os.path.abspath(index_file)}")
+ self.coverage._message(f"Wrote HTML report to {print_href}")
# Write the latest hashes for next time.
self.incr.write()
diff --git a/coverage/misc.py b/coverage/misc.py
index 8cefa12e0..061682ee5 100644
--- a/coverage/misc.py
+++ b/coverage/misc.py
@@ -386,3 +386,15 @@ def plural(n: int, thing: str = "", things: str = "") -> str:
return thing
else:
return things or (thing + "s")
+
+
+def stdout_link(text: str, url: str) -> str:
+ """Format text+url as a clickable link for stdout.
+
+ If attached to a terminal, use escape sequences. Otherwise, just return
+ the text.
+ """
+ if sys.stdout.isatty():
+ return f"\033]8;;{url}\a{text}\033]8;;\a"
+ else:
+ return text
diff --git a/coverage/version.py b/coverage/version.py
index 9cf7d9d19..d878ebc1b 100644
--- a/coverage/version.py
+++ b/coverage/version.py
@@ -8,7 +8,7 @@
# version_info: same semantics as sys.version_info.
# _dev: the .devN suffix if any.
-version_info = (7, 2, 3, "final", 0)
+version_info = (7, 2, 4, "final", 0)
_dev = 0
diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py
index 2c8fd0cc1..82e60fc1f 100644
--- a/coverage/xmlreport.py
+++ b/coverage/xmlreport.py
@@ -67,7 +67,9 @@ def __init__(self, coverage: Coverage) -> None:
if self.config.source:
for src in self.config.source:
if os.path.exists(src):
- if not self.config.relative_files:
+ if self.config.relative_files:
+ src = src.rstrip(r"\/")
+ else:
src = files.canonical_filename(src)
self.source_paths.add(src)
self.packages: Dict[str, PackageData] = {}
diff --git a/doc/conf.py b/doc/conf.py
index f6310b577..f0b2d6e42 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -66,11 +66,11 @@
# @@@ editable
copyright = "2009–2023, Ned Batchelder" # pylint: disable=redefined-builtin
# The short X.Y.Z version.
-version = "7.2.3"
+version = "7.2.4"
# The full version, including alpha/beta/rc tags.
-release = "7.2.3"
+release = "7.2.4"
# The date of release, in "monthname day, year" format.
-release_date = "April 6, 2023"
+release_date = "April 28, 2023"
# @@@ end
rst_epilog = """
diff --git a/doc/index.rst b/doc/index.rst
index b11dc90e9..2420aa6f8 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -234,4 +234,5 @@ More information
trouble
faq
Change history
+ migrating
sleepy
diff --git a/doc/migrating.rst b/doc/migrating.rst
new file mode 100644
index 000000000..7a5e65df8
--- /dev/null
+++ b/doc/migrating.rst
@@ -0,0 +1,29 @@
+.. Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+.. For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
+
+.. _migrating:
+
+==========================
+Migrating between versions
+==========================
+
+New major versions of coverage.py might require you to adjust your settings,
+options, or other aspects of your use. This page details those changes.
+
+.. _migrating_6x_7x:
+
+Migrating from 6.x to 7.x
+-------------------------
+
+- The way that wildcards when specifying file paths work in certain cases has changed in 7.x:
+
+ - Previously, ``*`` would incorrectly match directory separators, making
+ precise matching difficult. Patterns such as ``*tests/*``
+ will need to be changed to ``*/tests/*``.
+
+ - ``**`` now matches any number of nested directories. If you wish to retain the behavior of
+ ``**/tests/*`` in previous versions then ``*/**/tests/*`` can be used instead.
+
+- When remapping file paths with ``[paths]``, a path will be remapped only if
+ the resulting path exists. Ensure that remapped ``[paths]`` exist when upgrading
+ as this is now being enforced.
diff --git a/doc/requirements.pip b/doc/requirements.pip
index b13fedcd8..5bd841b0e 100644
--- a/doc/requirements.pip
+++ b/doc/requirements.pip
@@ -6,7 +6,7 @@
#
alabaster==0.7.13
# via sphinx
-attrs==22.2.0
+attrs==23.1.0
# via scriv
babel==2.12.1
# via sphinx
@@ -32,8 +32,9 @@ idna==3.4
# via requests
imagesize==1.4.1
# via sphinx
-importlib-metadata==6.1.0
+importlib-metadata==6.6.0
# via
+ # attrs
# click
# sphinx
# sphinxcontrib-spelling
@@ -45,13 +46,13 @@ livereload==2.6.3
# via sphinx-autobuild
markupsafe==2.1.2
# via jinja2
-packaging==23.0
+packaging==23.1
# via sphinx
pyenchant==3.2.2
# via
# -r doc/requirements.in
# sphinxcontrib-spelling
-pygments==2.14.0
+pygments==2.15.1
# via sphinx
pytz==2023.3
# via babel
@@ -59,7 +60,7 @@ requests==2.28.2
# via
# scriv
# sphinx
-scriv==1.2.1
+scriv==1.3.1
# via -r doc/requirements.in
six==1.16.0
# via livereload
diff --git a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
index a15b8decf..6351b32dd 100644
--- a/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
+++ b/doc/sample_html/d_7b071bdc2a35fa80___init___py.html
@@ -66,8 +66,8 @@