Skip to content

Commit

Permalink
Add some sleeps and debug output to rule out race condition for GitHu…
Browse files Browse the repository at this point in the history
…b Actions test failure
  • Loading branch information
WillGibson committed Dec 31, 2024
1 parent 587f7d3 commit 2edd3ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mutmut/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ def run_forced_fail_test(runner):
try:
if runner.run_forced_fail() == 0:
catcher.dump_output()
print("FAILED: Unable to force test failures")
print("\nFAILED: Unable to force test failures")
sleep(2)
raise SystemExit(1)
except MutmutProgrammaticFailException:
pass
Expand Down
16 changes: 16 additions & 0 deletions tests/test_mutation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
from io import StringIO
from time import sleep
from unittest.mock import Mock

import pytest
Expand Down Expand Up @@ -419,6 +420,11 @@ def test_run_forced_fail_test_with_failing_test(capfd):
run_forced_fail_test(runner)

out, err = capfd.readouterr()
print(f"out: {out}")
print(f"err: {err}")
sleep(2)
print(f"out: {out}")
print(f"err: {err}")
assert 'Running forced fail test' in out
assert 'done' in out
assert os.environ['MUTANT_UNDER_TEST'] is ''
Expand All @@ -431,6 +437,11 @@ def test_run_forced_fail_test_with_mutmut_programmatic_fail_exception(capfd):
run_forced_fail_test(runner)

out, err = capfd.readouterr()
print(f"out: {out}")
print(f"err: {err}")
sleep(2)
print(f"out: {out}")
print(f"err: {err}")
assert 'Running forced fail test' in out
assert 'done' in out
assert os.environ['MUTANT_UNDER_TEST'] is ''
Expand All @@ -445,6 +456,11 @@ def test_run_forced_fail_test_with_all_tests_passing(capfd):

assert error.value.code is 1
out, err = capfd.readouterr()
print(f"out: {out}")
print(f"err: {err}")
sleep(2)
print(f"out: {out}")
print(f"err: {err}")
assert 'Running forced fail test' in out
assert 'FAILED: Unable to force test failures' in out

Expand Down

0 comments on commit 2edd3ea

Please sign in to comment.