Skip to content

Commit b7dc6b8

Browse files
authored
Merge pull request #359 from asmacdo/rerun-sigint-flake
Increase wait time on rerun for flakey tests
2 parents fe61c58 + 8c26f52 commit b7dc6b8

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

test/duct_main/test_execution.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,14 @@ def _runner_for_signal_int(temp_output_dir: str, fail_time: float | None) -> int
230230
)
231231

232232

233+
@pytest.mark.flaky(reruns=5)
233234
@pytest.mark.parametrize("fail_time", [None, 0, 10, -1, -3.14])
234-
def test_signal_int(temp_output_dir: str, fail_time: float | None) -> None:
235-
236-
wait_time = 0.3
235+
def test_signal_int(
236+
request: pytest.FixtureRequest, temp_output_dir: str, fail_time: float | None
237+
) -> None:
238+
# Scale wait time on retries to handle slow CI runners (PyPy, Mac)
239+
attempt = getattr(request.node, "execution_count", 1)
240+
wait_time = 0.2 * attempt
237241
proc = multiprocessing.Process(
238242
target=_runner_for_signal_int, args=(temp_output_dir, fail_time)
239243
)
@@ -266,10 +270,14 @@ def _runner_for_signal_kill(temp_output_dir: str, fail_time: float | None) -> in
266270
return run_duct_command([script_path], output_prefix=temp_output_dir, **kws)
267271

268272

273+
@pytest.mark.flaky(reruns=5)
269274
@pytest.mark.parametrize("fail_time", [None, 0, 10, -1, -3.14])
270-
def test_signal_kill(temp_output_dir: str, fail_time: float | None) -> None:
271-
272-
wait_time = 0.6
275+
def test_signal_kill(
276+
request: pytest.FixtureRequest, temp_output_dir: str, fail_time: float | None
277+
) -> None:
278+
# Scale wait time on retries to handle slow CI runners (PyPy, Mac)
279+
attempt = getattr(request.node, "execution_count", 1)
280+
wait_time = 0.2 * attempt
273281
proc = multiprocessing.Process(
274282
target=_runner_for_signal_kill, args=(temp_output_dir, fail_time)
275283
)

0 commit comments

Comments
 (0)