summaryrefslogtreecommitdiffstats
path: root/tests/features/environment.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/features/environment.py')
-rw-r--r--tests/features/environment.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/features/environment.py b/tests/features/environment.py
index 049c2f2..215c85c 100644
--- a/tests/features/environment.py
+++ b/tests/features/environment.py
@@ -38,7 +38,7 @@ def before_all(context):
vi = "_".join([str(x) for x in sys.version_info[:3]])
db_name = context.config.userdata.get("pg_test_db", "pgcli_behave_tests")
- db_name_full = "{0}_{1}".format(db_name, vi)
+ db_name_full = f"{db_name}_{vi}"
# Store get params from config.
context.conf = {
@@ -63,7 +63,7 @@ def before_all(context):
"import coverage",
"coverage.process_startup()",
"import pgcli.main",
- "pgcli.main.cli()",
+ "pgcli.main.cli(auto_envvar_prefix='BEHAVE')",
]
),
)
@@ -102,6 +102,7 @@ def before_all(context):
else:
if "PGPASSWORD" in os.environ:
del os.environ["PGPASSWORD"]
+ os.environ["BEHAVE_WARN"] = "moderate"
context.cn = dbutils.create_db(
context.conf["host"],
@@ -122,12 +123,12 @@ def before_all(context):
def show_env_changes(env_old, env_new):
"""Print out all test-specific env values."""
print("--- os.environ changed values: ---")
- all_keys = set(list(env_old.keys()) + list(env_new.keys()))
+ all_keys = env_old.keys() | env_new.keys()
for k in sorted(all_keys):
old_value = env_old.get(k, "")
new_value = env_new.get(k, "")
if new_value and old_value != new_value:
- print('{}="{}"'.format(k, new_value))
+ print(f'{k}="{new_value}"')
print("-" * 20)
@@ -173,13 +174,13 @@ def after_scenario(context, scenario):
# Quit nicely.
if not context.atprompt:
dbname = context.currentdb
- context.cli.expect_exact("{0}> ".format(dbname), timeout=15)
+ context.cli.expect_exact(f"{dbname}> ", timeout=15)
context.cli.sendcontrol("c")
context.cli.sendcontrol("d")
try:
context.cli.expect_exact(pexpect.EOF, timeout=15)
except pexpect.TIMEOUT:
- print("--- after_scenario {}: kill cli".format(scenario.name))
+ print(f"--- after_scenario {scenario.name}: kill cli")
context.cli.kill(signal.SIGKILL)
if hasattr(context, "tmpfile_sql_help") and context.tmpfile_sql_help:
context.tmpfile_sql_help.close()