Merging upstream version 3.2.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
a868bb3d29
commit
39b7cc8559
50 changed files with 952 additions and 634 deletions
|
@ -65,19 +65,20 @@ def step_ctrl_d(context):
|
|||
Send Ctrl + D to hopefully exit.
|
||||
"""
|
||||
# turn off pager before exiting
|
||||
context.cli.sendline("\pset pager off")
|
||||
context.cli.sendcontrol("c")
|
||||
context.cli.sendline(r"\pset pager off")
|
||||
wrappers.wait_prompt(context)
|
||||
context.cli.sendcontrol("d")
|
||||
context.cli.expect(pexpect.EOF, timeout=15)
|
||||
context.exit_sent = True
|
||||
|
||||
|
||||
@when('we send "\?" command')
|
||||
@when(r'we send "\?" command')
|
||||
def step_send_help(context):
|
||||
"""
|
||||
r"""
|
||||
Send \? to see help.
|
||||
"""
|
||||
context.cli.sendline("\?")
|
||||
context.cli.sendline(r"\?")
|
||||
|
||||
|
||||
@when("we send partial select command")
|
||||
|
@ -96,9 +97,9 @@ def step_see_error_message(context):
|
|||
@when("we send source command")
|
||||
def step_send_source_command(context):
|
||||
context.tmpfile_sql_help = tempfile.NamedTemporaryFile(prefix="pgcli_")
|
||||
context.tmpfile_sql_help.write(b"\?")
|
||||
context.tmpfile_sql_help.write(br"\?")
|
||||
context.tmpfile_sql_help.flush()
|
||||
context.cli.sendline("\i {0}".format(context.tmpfile_sql_help.name))
|
||||
context.cli.sendline(fr"\i {context.tmpfile_sql_help.name}")
|
||||
wrappers.expect_exact(context, context.conf["pager_boundary"] + "\r\n", timeout=5)
|
||||
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ def step_db_create(context):
|
|||
"""
|
||||
Send create database.
|
||||
"""
|
||||
context.cli.sendline("create database {0};".format(context.conf["dbname_tmp"]))
|
||||
context.cli.sendline("create database {};".format(context.conf["dbname_tmp"]))
|
||||
|
||||
context.response = {"database_name": context.conf["dbname_tmp"]}
|
||||
|
||||
|
@ -24,7 +24,7 @@ def step_db_drop(context):
|
|||
"""
|
||||
Send drop database.
|
||||
"""
|
||||
context.cli.sendline("drop database {0};".format(context.conf["dbname_tmp"]))
|
||||
context.cli.sendline("drop database {};".format(context.conf["dbname_tmp"]))
|
||||
|
||||
|
||||
@when("we connect to test database")
|
||||
|
@ -33,7 +33,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(f"\\connect {db_name}")
|
||||
|
||||
|
||||
@when("we connect to dbserver")
|
||||
|
@ -59,7 +59,7 @@ def step_see_prompt(context):
|
|||
Wait to see the prompt.
|
||||
"""
|
||||
db_name = getattr(context, "currentdb", context.conf["dbname"])
|
||||
wrappers.expect_exact(context, "{0}> ".format(db_name), timeout=5)
|
||||
wrappers.expect_exact(context, f"{db_name}> ", timeout=5)
|
||||
context.atprompt = True
|
||||
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ def step_prepare_data(context):
|
|||
@when("we set expanded {mode}")
|
||||
def step_set_expanded(context, mode):
|
||||
"""Set expanded to mode."""
|
||||
context.cli.sendline("\\" + "x {}".format(mode))
|
||||
context.cli.sendline("\\" + f"x {mode}")
|
||||
wrappers.expect_exact(context, "Expanded display is", timeout=2)
|
||||
wrappers.wait_prompt(context)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ def step_edit_file(context):
|
|||
)
|
||||
if os.path.exists(context.editor_file_name):
|
||||
os.remove(context.editor_file_name)
|
||||
context.cli.sendline("\e {0}".format(os.path.basename(context.editor_file_name)))
|
||||
context.cli.sendline(r"\e {}".format(os.path.basename(context.editor_file_name)))
|
||||
wrappers.expect_exact(
|
||||
context, 'Entering Ex mode. Type "visual" to go to Normal mode.', timeout=2
|
||||
)
|
||||
|
@ -53,7 +53,7 @@ def step_tee_ouptut(context):
|
|||
)
|
||||
if os.path.exists(context.tee_file_name):
|
||||
os.remove(context.tee_file_name)
|
||||
context.cli.sendline("\o {0}".format(os.path.basename(context.tee_file_name)))
|
||||
context.cli.sendline(r"\o {}".format(os.path.basename(context.tee_file_name)))
|
||||
wrappers.expect_exact(context, context.conf["pager_boundary"] + "\r\n", timeout=5)
|
||||
wrappers.expect_exact(context, "Writing to file", timeout=5)
|
||||
wrappers.expect_exact(context, context.conf["pager_boundary"] + "\r\n", timeout=5)
|
||||
|
@ -67,7 +67,7 @@ def step_query_select_123456(context):
|
|||
|
||||
@when("we stop teeing output")
|
||||
def step_notee_output(context):
|
||||
context.cli.sendline("\o")
|
||||
context.cli.sendline(r"\o")
|
||||
wrappers.expect_exact(context, "Time", timeout=5)
|
||||
|
||||
|
||||
|
|
|
@ -22,5 +22,10 @@ def step_see_refresh_started(context):
|
|||
Wait to see refresh output.
|
||||
"""
|
||||
wrappers.expect_pager(
|
||||
context, "Auto-completion refresh started in the background.\r\n", timeout=2
|
||||
context,
|
||||
[
|
||||
"Auto-completion refresh started in the background.\r\n",
|
||||
"Auto-completion refresh restarted.\r\n",
|
||||
],
|
||||
timeout=2,
|
||||
)
|
||||
|
|
|
@ -39,9 +39,15 @@ def expect_exact(context, expected, timeout):
|
|||
|
||||
|
||||
def expect_pager(context, expected, timeout):
|
||||
formatted = expected if isinstance(expected, list) else [expected]
|
||||
formatted = [
|
||||
f"{context.conf['pager_boundary']}\r\n{t}{context.conf['pager_boundary']}\r\n"
|
||||
for t in formatted
|
||||
]
|
||||
|
||||
expect_exact(
|
||||
context,
|
||||
"{0}\r\n{1}{0}\r\n".format(context.conf["pager_boundary"], expected),
|
||||
formatted,
|
||||
timeout=timeout,
|
||||
)
|
||||
|
||||
|
@ -57,7 +63,7 @@ def run_cli(context, run_args=None, prompt_check=True, currentdb=None):
|
|||
context.cli.logfile = context.logfile
|
||||
context.exit_sent = False
|
||||
context.currentdb = currentdb or context.conf["dbname"]
|
||||
context.cli.sendline("\pset pager always")
|
||||
context.cli.sendline(r"\pset pager always")
|
||||
if prompt_check:
|
||||
wait_prompt(context)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue