Skip to content

Commit 1060813

Browse files
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>
1 parent c31e9ad commit 1060813

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

coverage/data.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ def combine_parallel_data(
132132
data.update(new_data, aliases=aliases)
133133
files_combined += 1
134134
if message:
135-
message(f"Combined data file {os.path.relpath(f)}")
135+
try:
136+
message(f"Combined data file {os.path.relpath(f)}")
137+
except ValueError:
138+
# ValueError can be raised under Windows when os.getcwd() returns a
139+
# folder from a different drive than the drive of f, in which case
140+
# we print the original value of f instead of its relative path
141+
message(f"Combined data file {f!r}")
136142
if not keep:
137143
if data._debug.should('dataio'):
138144
data._debug.write(f"Deleting combined data file {f!r}")

0 commit comments

Comments
 (0)