From 4b770f4f35bed9ce569338d2ad62093d9ac538c2 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 21 Dec 2015 08:55:55 +0100 Subject: [PATCH] tests: Try to work around race condition. --- tests/unit/commands/test_userscripts.py | 4 ++++ 1 file changed, 4 insertions(+) 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)