From 088ce366b26ad3cfb6f738a5bc77b37d7d06d253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lorenzo=20Mic=C3=B2?= Date: Wed, 3 Aug 2022 10:14:32 +0200 Subject: [PATCH] fix: don't fail if can't find a relative path to a data file on another volume on win32 (#1428) --- coverage/data.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coverage/data.py b/coverage/data.py index f605e1644..bcbfa427c 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}")