summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2017-10-06 11:19:44 -0700
committerIrina Truong <i.chernyavska@gmail.com>2017-10-06 11:19:44 -0700
commit1a7a8231699e0a7a9dc6a8bc0da8dc93634d9cfa (patch)
treedd922d534dc5ceab92edb36add7bcc89d112cc9f /tests
parent915ffb70a70a855bfc8cbc2d3b7ab9828e102775 (diff)
Work around a race condition when reading tee output.
Diffstat (limited to 'tests')
-rw-r--r--tests/features/iocommands.feature2
-rw-r--r--tests/features/steps/iocommands.py14
2 files changed, 11 insertions, 5 deletions
diff --git a/tests/features/iocommands.feature b/tests/features/iocommands.feature
index 38efbbb0..dad7d10e 100644
--- a/tests/features/iocommands.feature
+++ b/tests/features/iocommands.feature
@@ -12,6 +12,6 @@ Feature: I/O commands
and we wait for prompt
and we query "select 123456"
and we wait for prompt
- and we notee output
+ and we stop teeing output
and we wait for prompt
then we see 123456 in tee output
diff --git a/tests/features/steps/iocommands.py b/tests/features/steps/iocommands.py
index bc0eb755..94e0a1d8 100644
--- a/tests/features/steps/iocommands.py
+++ b/tests/features/steps/iocommands.py
@@ -5,6 +5,7 @@ import os.path
import wrappers
from behave import when, then
+from retrying import retry
@when('we start external editor providing a file name')
@@ -67,16 +68,21 @@ def step_query_select_123456(context):
context.cli.sendline('select 123456')
-@when(u'we notee output')
+@when(u'we stop teeing output')
def step_notee_output(context):
- context.cli.sendline('notee')
+ context.cli.sendline('\o')
wrappers.expect_exact(context, "Time", timeout=5)
@then(u'we see 123456 in tee output')
def step_see_123456_in_ouput(context):
- with open(context.tee_file_name) as f:
- assert '123456' in f.read()
+
+ @retry(stop_max_delay=3000) # stop trying after 3 seconds
+ def assert_tee_output():
+ with open(context.tee_file_name) as f:
+ assert '123456' in f.read()
+
+ assert_tee_output()
if os.path.exists(context.tee_file_name):
os.remove(context.tee_file_name)
context.atprompt = True