summaryrefslogtreecommitdiffstats
path: root/tests/features/steps/wrappers.py
diff options
context:
space:
mode:
authorIrina Truong <i.chernyavska@gmail.com>2019-05-25 13:08:56 -0700
committerGitHub <noreply@github.com>2019-05-25 13:08:56 -0700
commit8cb7009bcd0f0062942932c853706a36178f566c (patch)
treecb5bb42674ccce90b173e7a2f09bf72157ae4a86 /tests/features/steps/wrappers.py
parenta5e607b6fc889afd3f8960ca3903ae16b641c304 (diff)
black all the things. (#1049)
* added black to develop guide * no need for pep8radius. * changelog. * Add pre-commit checkbox. * Add pre-commit to dev reqs. * Add pyproject.toml for black. * Pre-commit config. * Add black to travis and dev reqs. * Install and run black in travis. * Remove black from dev reqs. * Lower black target version. * Re-format with black.
Diffstat (limited to 'tests/features/steps/wrappers.py')
-rw-r--r--tests/features/steps/wrappers.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/features/steps/wrappers.py b/tests/features/steps/wrappers.py
index 23f9cc2b..9a2db982 100644
--- a/tests/features/steps/wrappers.py
+++ b/tests/features/steps/wrappers.py
@@ -20,10 +20,10 @@ def expect_exact(context, expected, timeout):
timedout = True
if timedout:
# Strip color codes out of the output.
- actual = re.sub(r'\x1b\[([0-9A-Za-z;?])+[m|K]?',
- '', context.cli.before)
+ actual = re.sub(r"\x1b\[([0-9A-Za-z;?])+[m|K]?", "", context.cli.before)
raise Exception(
- textwrap.dedent('''\
+ textwrap.dedent(
+ """\
Expected:
---
{0!r}
@@ -36,35 +36,35 @@ def expect_exact(context, expected, timeout):
---
{2!r}
---
- ''').format(
- expected,
- actual,
- context.logfile.getvalue()
- )
+ """
+ ).format(expected, actual, context.logfile.getvalue())
)
def expect_pager(context, expected, timeout):
- expect_exact(context, "{0}\r\n{1}{0}\r\n".format(
- context.conf['pager_boundary'], expected), timeout=timeout)
+ expect_exact(
+ context,
+ "{0}\r\n{1}{0}\r\n".format(context.conf["pager_boundary"], expected),
+ timeout=timeout,
+ )
def run_cli(context, run_args=None, prompt_check=True, currentdb=None):
"""Run the process using pexpect."""
run_args = run_args or []
- cli_cmd = context.conf.get('cli_command')
+ cli_cmd = context.conf.get("cli_command")
cmd_parts = [cli_cmd] + run_args
- cmd = ' '.join(cmd_parts)
+ cmd = " ".join(cmd_parts)
context.cli = pexpect.spawnu(cmd, cwd=context.package_root)
context.logfile = StringIO()
context.cli.logfile = context.logfile
context.exit_sent = False
- context.currentdb = currentdb or context.conf['dbname']
- context.cli.sendline('\pset pager always')
+ context.currentdb = currentdb or context.conf["dbname"]
+ context.cli.sendline("\pset pager always")
if prompt_check:
wait_prompt(context)
def wait_prompt(context):
"""Make sure prompt is displayed."""
- expect_exact(context, '{0}> '.format(context.conf['dbname']), timeout=5)
+ expect_exact(context, "{0}> ".format(context.conf["dbname"]), timeout=5)