Skip to content

Commit 17fa2ad

Browse files
ark-gnedbat
authored andcommitted
test: update --save-signal tests
Signed-off-by: Arkady Gilinsky <[email protected]> can we simplify the status/exit logic
1 parent 5ae4052 commit 17fa2ad

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/coveragetest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from collections.abc import Collection, Iterable, Iterator, Mapping, Sequence
2525

2626
import coverage
27-
from coverage import Coverage
27+
from coverage import Coverage, env
2828
from coverage.cmdline import CoverageScript
2929
from coverage.data import CoverageData
3030
from coverage.misc import import_local_file
@@ -417,6 +417,9 @@ def run_command(self, cmd: str, *, status: int = 0) -> str:
417417
Compare with `command_line`.
418418
419419
"""
420+
if status < 0 and env.LINUX:
421+
# Mac properly returns -signal as the exit status. Linux returns 128 + signal.
422+
status = 128 - status
420423
actual_status, output = self.run_command_status(cmd)
421424
assert actual_status == status
422425
return output

tests/test_process.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def test_save_signal_usr1(self) -> None:
731731
print('Done and goodbye')
732732
""")
733733
covered_lines = 4
734-
self.run_command(f"coverage run --save-signal USR1 {test_file}")
734+
self.run_command(f"coverage run --save-signal USR1 {test_file}", status=-signal.SIGKILL)
735735
self.assert_exists(".coverage")
736736
data = coverage.CoverageData()
737737
data.read()

0 commit comments

Comments
 (0)