diff options
author | Lorenzo Micò <41483803+lormico@users.noreply.github.com> | 2022-08-06 20:00:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-06 11:00:15 -0700 |
commit | 1060813b718e60ad52508bf9df33d18e493cea56 (patch) | |
tree | a19240f9abf13cc7ee8f6850aea1eb7efaa07c22 /coverage/data.py | |
parent | c31e9ad4fb1e9c2be5d60e10038514b443817afb (diff) | |
download | python-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.py | 8 |
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}") |