summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coverage/data.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/coverage/data.py b/coverage/data.py
index c737d593..abe6b510 100644
--- a/coverage/data.py
+++ b/coverage/data.py
@@ -145,11 +145,17 @@ def combine_parallel_data(
# we print the original value of f instead of its relative path
rel_file_name = f
- with open(f, "rb") as fobj:
- hasher = hashlib.new("sha3_256")
- hasher.update(fobj.read())
- sha = hasher.digest()
- combine_this_one = sha not in file_hashes
+ try:
+ with open(f, "rb") as fobj:
+ hasher = hashlib.new("sha3_256")
+ hasher.update(fobj.read())
+ sha = hasher.digest()
+ combine_this_one = sha not in file_hashes
+ except FileNotFoundError as exc:
+ if data._warn:
+ data._warn(str(exc))
+ if message:
+ message(f"Couldn't combine data file {rel_file_name}: {exc}")
delete_this_one = not keep
if combine_this_one: