From ea80ded8d5057e7a8ad92315cae4a5e9088069ea Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 8 Feb 2018 20:21:25 +0100 Subject: [PATCH] Try to stabilize editor end2end test Let's also wait until we're sure the mtime changed here. --- tests/end2end/features/test_editor_bdd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/end2end/features/test_editor_bdd.py b/tests/end2end/features/test_editor_bdd.py index 2f425c41b..bc1397bf7 100644 --- a/tests/end2end/features/test_editor_bdd.py +++ b/tests/end2end/features/test_editor_bdd.py @@ -85,8 +85,13 @@ def set_up_editor_wait(quteproc, tmpdir, text): import signal def handle(sig, _frame): - with open(sys.argv[1], 'w', encoding='utf-8') as f: - f.write({text!r}) + filename = sys.argv[1] + old_mtime = new_mtime = os.stat(filename).st_mtime + while old_mtime == new_mtime: + time.sleep(0.1) + with open(filename, 'w', encoding='utf-8') as f: + f.write({text!r}) + new_mtime = os.stat(filename).st_mtime if sig == signal.SIGUSR1: sys.exit(0)