diff --git a/tests/unit/commands/test_userscripts.py b/tests/unit/commands/test_userscripts.py index dab2aada7..dbd921fa6 100644 --- a/tests/unit/commands/test_userscripts.py +++ b/tests/unit/commands/test_userscripts.py @@ -19,6 +19,7 @@ import os import json +import time import logging import signal @@ -194,6 +195,9 @@ def test_killed_command(qtbot, tmpdir, py_proc, runner): timeout=10000): runner.run(cmd, *args, env=env) + # Make sure the PID was written to the file, not just the file created + time.sleep(0.5) + with qtbot.waitSignal(runner.finished, raising=True): os.kill(int(pidfile.read()), signal.SIGTERM)