From 0aefffce4dab9afd99c278558af605d626441ca8 Mon Sep 17 00:00:00 2001 From: Ryan Roden-Corrent Date: Thu, 1 Feb 2018 20:55:18 -0500 Subject: [PATCH] Attempt to solve flaky editor tests. These are passing locally but failing in travis. This fixes two possible timing issues: - Ensure the signals are set up befor the pidfile is written. The function that sends the signal waits for the pidfile to exist, so this ensures we don't miss a signal. - Wait for the log message indicating that the editor file was read back, so the test doesn't run through before we get a chance to read from the editor. --- tests/end2end/features/editor.feature | 1 + tests/end2end/features/test_editor_bdd.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/end2end/features/editor.feature b/tests/end2end/features/editor.feature index 489fc7200..391e88749 100644 --- a/tests/end2end/features/editor.feature +++ b/tests/end2end/features/editor.feature @@ -138,6 +138,7 @@ Feature: Opening external editors And I wait for "Entering mode KeyMode.insert (reason: clicking input)" in the log And I run :open-editor And I save without exiting the editor + And I wait for "Read back: foobar" in the log And I run :click-element id qute-button Then the javascript message "text: foobar" should be logged diff --git a/tests/end2end/features/test_editor_bdd.py b/tests/end2end/features/test_editor_bdd.py index e2415da46..4e480b85d 100644 --- a/tests/end2end/features/test_editor_bdd.py +++ b/tests/end2end/features/test_editor_bdd.py @@ -90,11 +90,12 @@ def set_up_editor_wait(quteproc, tmpdir, text): if sig == signal.SIGUSR1: sys.exit(0) + signal.signal(signal.SIGUSR1, handle) + signal.signal(signal.SIGUSR2, handle) + with open(r'{pidfile}', 'w') as f: f.write(str(os.getpid())) - signal.signal(signal.SIGUSR1, handle) - signal.signal(signal.SIGUSR2, handle) time.sleep(100) """.format(pidfile=pidfile, text=text))) editor = json.dumps([sys.executable, str(script), '{}'])