mirror of https://github.com/dbcli/pgcli
Work around a race condition when reading tee output.
This commit is contained in:
parent
915ffb70a7
commit
1a7a823169
|
@ -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:
|
||||
|
|
|
@ -4,4 +4,6 @@ tox>=1.9.2
|
|||
behave>=1.2.4
|
||||
pexpect==3.3
|
||||
coverage==4.3.4
|
||||
pep8radius
|
||||
pep8radius>=0.9.2
|
||||
retrying>=1.3.3
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue