Skip to content

Commit ff696ab

Browse files
committed
Update signal test functions
Signed-off-by: Arkady Gilinsky <[email protected]>
1 parent f3bcee1 commit ff696ab

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

tests/coveragetest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ def run_command(self, cmd: str, *, status: int = 0) -> str:
418418
419419
"""
420420
actual_status, output = self.run_command_status(cmd)
421-
assert actual_status == status
421+
if actual_status > 128:
422+
# Killed by signal, shell returns 128 + signal_num
423+
assert actual_status == 128 + (-1 * status)
424+
else:
425+
assert actual_status == status
422426
return output
423427

424428
def run_command_status(self, cmd: str) -> tuple[int, str]:

tests/test_process.py

Lines changed: 2 additions & 2 deletions
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 = -9)
735735
self.assert_exists(".coverage")
736736
data = coverage.CoverageData()
737737
data.read()
@@ -758,7 +758,7 @@ def test_save_signal_kill(self) -> None:
758758
759759
print('Done and goodbye')
760760
""")
761-
self.run_command(f"coverage run --save-signal USR1 {test_file}")
761+
self.run_command(f"coverage run --save-signal USR1 {test_file}", status = -9)
762762
self.assert_doesnt_exist(".coverage")
763763

764764

0 commit comments

Comments
 (0)