summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEVELOP.rst1
-rw-r--r--tests/behave.ini (renamed from behave.ini)0
-rw-r--r--tests/features/db_utils.py (renamed from features/db_utils.py)3
-rw-r--r--tests/features/environment.py (renamed from features/environment.py)0
-rw-r--r--tests/features/fixture_data/help.txt (renamed from features/fixture_data/help.txt)2
-rw-r--r--tests/features/fixture_data/help_commands.txt (renamed from features/fixture_data/help_commands.txt)4
-rw-r--r--tests/features/fixture_utils.py (renamed from features/fixture_utils.py)2
-rw-r--r--tests/features/simple_cli_commands.feature (renamed from features/simple_cli_commands.feature)0
-rw-r--r--tests/features/steps/step_definitions.py (renamed from features/steps/step_definitions.py)5
9 files changed, 11 insertions, 6 deletions
diff --git a/DEVELOP.rst b/DEVELOP.rst
index 39e932f0..59ec5ad4 100644
--- a/DEVELOP.rst
+++ b/DEVELOP.rst
@@ -144,6 +144,7 @@ After that, tests can be run with:
::
+ $ cd tests
$ behave
To see stdout/stderr, use the following command:
diff --git a/behave.ini b/tests/behave.ini
index c555d3c0..c555d3c0 100644
--- a/behave.ini
+++ b/tests/behave.ini
diff --git a/features/db_utils.py b/tests/features/db_utils.py
index e059c762..1b514ed5 100644
--- a/features/db_utils.py
+++ b/tests/features/db_utils.py
@@ -23,6 +23,7 @@ def create_db(hostname='localhost', username=None, password=None,
cn.set_isolation_level(0)
with cn.cursor() as cr:
+ cr.execute('drop database if exists %s', (AsIs(dbname),))
cr.execute('create database %s', (AsIs(dbname),))
cn.close()
@@ -66,7 +67,7 @@ def drop_db(hostname='localhost', username=None, password=None,
cn.set_isolation_level(0)
with cn.cursor() as cr:
- cr.execute('drop database %s', (AsIs(dbname),))
+ cr.execute('drop database if exists %s', (AsIs(dbname),))
close_cn(cn)
diff --git a/features/environment.py b/tests/features/environment.py
index 64ca66de..64ca66de 100644
--- a/features/environment.py
+++ b/tests/features/environment.py
diff --git a/features/fixture_data/help.txt b/tests/features/fixture_data/help.txt
index 8a495041..deb499a4 100644
--- a/features/fixture_data/help.txt
+++ b/tests/features/fixture_data/help.txt
@@ -17,7 +17,7 @@
| \l | List databases. |
| \n[+] [name] | List or execute named queries. |
| \nd [name [query]] | Delete a named query. |
-| \ns [name [query]] | Save a named query. |
+| \ns name query | Save a named query. |
| \refresh | Refresh auto-completions. |
| \timing | Toggle timing of commands. |
| \x | Toggle expanded output. |
diff --git a/features/fixture_data/help_commands.txt b/tests/features/fixture_data/help_commands.txt
index fcee0775..3f3dd0b9 100644
--- a/features/fixture_data/help_commands.txt
+++ b/tests/features/fixture_data/help_commands.txt
@@ -14,8 +14,8 @@ Command
\e [file]
\l
\n[+] [name]
-\nd [name [query]]
-\ns [name [query]]
+\nd [name]
+\ns name query
\refresh
\timing
\x \ No newline at end of file
diff --git a/features/fixture_utils.py b/tests/features/fixture_utils.py
index af768977..917baeb3 100644
--- a/features/fixture_utils.py
+++ b/tests/features/fixture_utils.py
@@ -13,7 +13,7 @@ def read_fixture_lines(filename):
:return: list of strings
"""
lines = []
- for line in codecs.open(filename, 'r', encoding='utf-8'):
+ for line in codecs.open(filename, 'rb', encoding='utf-8'):
lines.append(line.strip())
return lines
diff --git a/features/simple_cli_commands.feature b/tests/features/simple_cli_commands.feature
index 1121651c..1121651c 100644
--- a/features/simple_cli_commands.feature
+++ b/tests/features/simple_cli_commands.feature
diff --git a/features/steps/step_definitions.py b/tests/features/steps/step_definitions.py
index 454d8cc3..53b0466c 100644
--- a/features/steps/step_definitions.py
+++ b/tests/features/steps/step_definitions.py
@@ -73,4 +73,7 @@ def step_see_prompt(context):
@then('we see help output')
def step_see_help(context):
for expected_line in context.fixture_data['help_commands.txt']:
- context.cli.expect_exact(expected_line)
+ try:
+ context.cli.expect_exact(expected_line, timeout=1)
+ except Exception:
+ raise Exception('Expected: ' + expected_line.strip() + '!')