Skip to content

Commit ef978c1

Browse files
committed
fix: reduce the scope of a try/except.
1 parent 1060813 commit ef978c1

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGES.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,17 @@ development at the same time, such as 4.5.x and 5.0.
2020
Unreleased
2121
----------
2222

23+
- Fix a messaging failure when combining Windows data files on a different
24+
drive than the current directory. (`pull 1430`_, fixing `issue 1428`_).
25+
Thanks, Lorenzo Micò.
26+
2327
- Fix a problem with Cython code measurement (`pull 1347`_, fixing `issue
2428
972`_). Thanks, Matus Valo.
2529

26-
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
2730
.. _issue 972: https://github.com/nedbat/coveragepy/issues/972
31+
.. _pull 1347: https://github.com/nedbat/coveragepy/pull/1347
32+
.. _pull 1428: https://github.com/nedbat/coveragepy/issues/1428
33+
.. _pull 1430: https://github.com/nedbat/coveragepy/pull/1430
2834

2935

3036
.. _changes_6-4-2:

CONTRIBUTORS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Lars Hupfeldt Nielsen
9898
Leonardo Pistone
9999
Lex Berezhny
100100
Loïc Dachary
101+
Lorenzo Micò
101102
Marc Abramowitz
102103
Marcelo Trylesinski
103104
Marcus Cobden

coverage/data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,13 @@ def combine_parallel_data(
133133
files_combined += 1
134134
if message:
135135
try:
136-
message(f"Combined data file {os.path.relpath(f)}")
136+
file_name = os.path.relpath(f)
137137
except ValueError:
138138
# ValueError can be raised under Windows when os.getcwd() returns a
139139
# folder from a different drive than the drive of f, in which case
140140
# we print the original value of f instead of its relative path
141-
message(f"Combined data file {f!r}")
141+
file_name = f
142+
message(f"Combined data file {file_name}")
142143
if not keep:
143144
if data._debug.should('dataio'):
144145
data._debug.write(f"Deleting combined data file {f!r}")

0 commit comments

Comments
 (0)