summaryrefslogtreecommitdiffstats
path: root/tests/features
diff options
context:
space:
mode:
authorIryna Cherniavska <i.chernyavska@gmail.com>2015-10-05 14:11:31 -0700
committerIryna Cherniavska <i.chernyavska@gmail.com>2015-10-05 14:11:31 -0700
commit08347934c450391c9582833e5b3fc4a508253fe5 (patch)
tree1ea3eec274b0373e11ce611d8fdeb1cb5387571e /tests/features
parent4055b726cca8d3c698968a96111050fade53995e (diff)
Fix for behave tests failing with pexpect 4.0.
Diffstat (limited to 'tests/features')
-rw-r--r--tests/features/environment.py5
-rw-r--r--tests/features/steps/step_definitions.py7
2 files changed, 5 insertions, 7 deletions
diff --git a/tests/features/environment.py b/tests/features/environment.py
index 2db9fdd8..a92c455b 100644
--- a/tests/features/environment.py
+++ b/tests/features/environment.py
@@ -84,6 +84,5 @@ def after_scenario(context, _):
"""
if hasattr(context, 'cli') and not context.exit_sent:
- # Send Ctrl + D into cli
- context.cli.sendcontrol('d')
- context.cli.expect(pexpect.EOF, timeout=5)
+ # Terminate nicely.
+ context.cli.terminate()
diff --git a/tests/features/steps/step_definitions.py b/tests/features/steps/step_definitions.py
index 8770af9a..afeb6af9 100644
--- a/tests/features/steps/step_definitions.py
+++ b/tests/features/steps/step_definitions.py
@@ -133,7 +133,7 @@ def step_db_connect_test(context):
Send connect to database.
"""
db_name = context.conf['dbname']
- context.cli.sendline('\connect {0}'.format(db_name))
+ context.cli.sendline('\\connect {0}'.format(db_name))
@when('we start external editor providing a file name')
@@ -177,7 +177,7 @@ def step_db_connect_postgres(context):
"""
Send connect to database.
"""
- context.cli.sendline('\connect postgres')
+ context.cli.sendline('\\connect postgres')
@when('we refresh completions')
@@ -296,8 +296,7 @@ def _expect_exact(context, expected, timeout):
context.cli.expect_exact(expected, timeout=timeout)
except:
# Strip color codes out of the output.
- actual = re.sub('\x1b\[[0-9;]*m', '', context.cli.before)
- actual = re.sub('\x1b\[(.*)?.{1}', '', actual)
+ actual = re.sub(r'\x1b\[([0-9A-Za-z;?])+[m|K]?', '', context.cli.before)
raise Exception('Expected:\n---\n{0}\n---\n\nActual:\n---\n{1}\n---'.format(
expected,
actual))