summaryrefslogtreecommitdiffstats
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
parent915ffb70a70a855bfc8cbc2d3b7ab9828e102775 (diff)
Work around a race condition when reading tee output.
-rw-r--r--.travis.yml4
-rw-r--r--requirements-dev.txt4
-rw-r--r--tests/features/iocommands.feature2
-rw-r--r--tests/features/steps/iocommands.py14
4 files changed, 16 insertions, 8 deletions
diff --git a/.travis.yml b/.travis.yml
index 76ae86ad..769f179c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,8 +6,8 @@ python:
- "3.5"
- "3.6"
-install:
- - pip install . docutils pytest mock codecov==1.5.1 behave pexpect==3.3
+install:
+ - pip install . docutils pytest mock codecov==1.5.1 behave pexpect==3.3 retrying>=1.3.3
- pip install git+https://github.com/hayd/pep8radius.git
script:
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 215b377a..6d362d1f 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -4,4 +4,6 @@ tox>=1.9.2
behave>=1.2.4
pexpect==3.3
coverage==4.3.4
-pep8radius \ No newline at end of file
+pep8radius>=0.9.2
+retrying>=1.3.3
+
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