summaryrefslogtreecommitdiff
path: root/coverage/data.py
diff options
context:
space:
mode:
authorLorenzo Micò <41483803+lormico@users.noreply.github.com>2022-08-06 20:00:15 +0200
committerGitHub <noreply@github.com>2022-08-06 11:00:15 -0700
commit1060813b718e60ad52508bf9df33d18e493cea56 (patch)
treea19240f9abf13cc7ee8f6850aea1eb7efaa07c22 /coverage/data.py
parentc31e9ad4fb1e9c2be5d60e10038514b443817afb (diff)
downloadpython-coveragepy-git-1060813b718e60ad52508bf9df33d18e493cea56.tar.gz
fix: don't fail if can't find a relative path to a data file on another volume on win32 (#1428) (#1430)
Co-authored-by: Lorenzo Micò <lmico@dxc.com>
Diffstat (limited to 'coverage/data.py')
-rw-r--r--coverage/data.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/data.py b/coverage/data.py
index f605e164..bcbfa427 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -132,7 +132,13 @@ def combine_parallel_data(
data.update(new_data, aliases=aliases)
files_combined += 1
if message:
- message(f"Combined data file {os.path.relpath(f)}")
+ try:
+ message(f"Combined data file {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}")
if not keep:
if data._debug.should('dataio'):
data._debug.write(f"Deleting combined data file {f!r}")