Skip to content

Commit

Permalink
Moved behavioral tests into tests. Updated expected help output. Drop…
Browse files Browse the repository at this point in the history
… test db if exists.
  • Loading branch information
j-bennet committed Jul 12, 2015
1 parent 7c0f1a1 commit 4980b4e
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ After that, tests can be run with:

::

$ cd tests
$ behave

To see stdout/stderr, use the following command:
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion features/db_utils.py → tests/features/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Command
\e [file]
\l
\n[+] [name]
\nd [name [query]]
\ns [name [query]]
\nd [name]
\ns name query
\refresh
\timing
\x
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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() + '!')

0 comments on commit 4980b4e

Please sign in to comment.