summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2018-09-28 14:18:40 -0700
committerGitHub <noreply@github.com>2018-09-28 14:18:40 -0700
commit392491a74d2d8abcb2c0db5230fc7f11502c6ba9 (patch)
tree20f88af6503783b0bc9880a440f5674264fa4220 /tests
parentd3bdb891d309622cbf4e59244a698def8a8bbd2d (diff)
Cherry-picked prompt-toolkit 2.0 changes. (#930)
* Cherry-picked prompt-toolkit 2.0 changes. * Increase help timeout. * Missed one. * Fixes editor command. * Expect exact to fix named query error. * Unicode is non-optional with ptk 2.0. * Unicode literals all the things (almost). * PEP8. * Change how we swap completers. * By default, bottom toolbar styles are reversed. We don't want that. * Adapt styles to 2.0. * The future is now. Switch to ptk 2.0 style names. * PEP8. * Flag for enable_open_in_editor. * add class:prompt to prompt * Removed workaround for #668. Some renaming. * use pgcli.completer instead of app.current_buffer.completer * enable_system_prompt=True like old prompt toolkit * keep search_ignore_case enabled (was ignore_case) * fix closing parenthese * keep marking class:continuation token for continuation * capture KeyboardInterrupt manually AbortAction has been removed in Prompt_toolkit 2.0 * replace C-J with enter, add more comments * reversed ([...]) to [(...)] (oops) * pep8 fixes * Does Vi mode have to be applied to session every time? * (workaround) also enable vi_mode after edit command * Fixed test errors after rebasing on master.
Diffstat (limited to 'tests')
-rw-r--r--tests/features/environment.py4
-rw-r--r--tests/features/steps/crud_database.py2
-rw-r--r--tests/features/steps/named_queries.py2
-rw-r--r--tests/metadata.py2
-rw-r--r--tests/test_main.py4
5 files changed, 8 insertions, 6 deletions
diff --git a/tests/features/environment.py b/tests/features/environment.py
index cab88b7d..5fa8b299 100644
--- a/tests/features/environment.py
+++ b/tests/features/environment.py
@@ -169,7 +169,7 @@ def after_scenario(context, _):
context.tmpfile_sql_help = None
-# TODO: uncomment to debug a failure
+# # TODO: uncomment to debug a failure
# def after_step(context, step):
# if step.status == "failed":
-# import ipdb; ipdb.set_trace()
+# import pdb; pdb.set_trace()
diff --git a/tests/features/steps/crud_database.py b/tests/features/steps/crud_database.py
index 4d692c6d..0a0928fc 100644
--- a/tests/features/steps/crud_database.py
+++ b/tests/features/steps/crud_database.py
@@ -72,7 +72,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']:
- wrappers.expect_exact(context, expected_line, timeout=1)
+ wrappers.expect_exact(context, expected_line, timeout=2)
@then('we see database created')
diff --git a/tests/features/steps/named_queries.py b/tests/features/steps/named_queries.py
index d60947ff..84afb11c 100644
--- a/tests/features/steps/named_queries.py
+++ b/tests/features/steps/named_queries.py
@@ -39,7 +39,7 @@ def step_see_named_query_saved(context):
"""
Wait to see query saved.
"""
- wrappers.expect_pager(context, 'Saved.\r\n', timeout=1)
+ wrappers.expect_exact(context, 'Saved.', timeout=2)
@then('we see the named query executed')
diff --git a/tests/metadata.py b/tests/metadata.py
index 9aa95953..1245a589 100644
--- a/tests/metadata.py
+++ b/tests/metadata.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
from functools import partial
from itertools import product
from pgcli.packages.parseutils.meta import FunctionMetadata, ForeignKey
diff --git a/tests/test_main.py b/tests/test_main.py
index cc7693a3..fc4de7d9 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -182,9 +182,9 @@ def pset_pager_mocks():
cli.watch_command = None
with mock.patch('pgcli.main.click.echo') as mock_echo, \
mock.patch('pgcli.main.click.echo_via_pager') as mock_echo_via_pager, \
- mock.patch.object(cli, 'cli') as mock_cli:
+ mock.patch.object(cli, 'prompt_app') as mock_app:
- yield cli, mock_echo, mock_echo_via_pager, mock_cli
+ yield cli, mock_echo, mock_echo_via_pager, mock_app
@pytest.mark.parametrize('term_height,term_width,text', test_data, ids=test_ids)