summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2022-08-06 14:07:11 -0400
committerNed Batchelder <ned@nedbatchelder.com>2022-08-06 14:07:11 -0400
commitef978c16ee7afaf5d30958c6214de2c755b4edbf (patch)
tree17ae4c67e7949ea5dad79e8a16ed8fde4f6beeff
parent1060813b718e60ad52508bf9df33d18e493cea56 (diff)
downloadpython-coveragepy-git-ef978c16ee7afaf5d30958c6214de2c755b4edbf.tar.gz
fix: reduce the scope of a try/except.
-rw-r--r--CHANGES.rst8
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--coverage/data.py5
3 files changed, 11 insertions, 3 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index ae770488..1a50184a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -20,11 +20,17 @@ development at the same time, such as 4.5.x and 5.0.
Unreleased
----------
+- Fix a messaging failure when combining Windows data files on a different
+ drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
+ Thanks, Lorenzo Micò.
+
- Fix a problem with Cython code measurement (`pull 1347`_, fixing `issue
972`_). Thanks, Matus Valo.
-.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
+.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
+.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
+.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
.. _changes_6-4-2:
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 2dde5f4a..76b5f570 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -98,6 +98,7 @@ Lars Hupfeldt Nielsen
Leonardo Pistone
Lex Berezhny
Loïc Dachary
+Lorenzo Micò
Marc Abramowitz
Marcelo Trylesinski
Marcus Cobden
diff --git a/coverage/data.py b/coverage/data.py
index bcbfa427..b209cf15 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -133,12 +133,13 @@ def combine_parallel_data(
files_combined += 1
if message:
try:
- message(f"Combined data file {os.path.relpath(f)}")
+ file_name = os.path.relpath(f)
except ValueError:
# ValueError can be raised under Windows when os.getcwd() returns a
# folder from a different drive than the drive of f, in which case
# we print the original value of f instead of its relative path
- message(f"Combined data file {f!r}")
+ file_name = f
+ message(f"Combined data file {file_name}")
if not keep:
if data._debug.should('dataio'):
data._debug.write(f"Deleting combined data file {f!r}")