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.
This commit is contained in:
Ryan Roden-Corrent 2018-02-01 20:55:18 -05:00
parent eab9b70f28
commit 0aefffce4d
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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), '{}'])