diff --git a/changelog.md b/changelog.md index bbafc6c3..183b421d 100644 --- a/changelog.md +++ b/changelog.md @@ -6,6 +6,11 @@ Features * Configurable sources of credentials to save to the keyring. +Internal +--------- +* Don't modify checked-in `test/myclirc` in the behave test suite. + + 2.4.0 (2026/07/18) ============== diff --git a/test/features/environment.py b/test/features/environment.py index 30a508c5..3b17cf51 100644 --- a/test/features/environment.py +++ b/test/features/environment.py @@ -3,6 +3,7 @@ import os import shutil import sys +import tempfile import db_utils as dbutils import fixture_utils as fixutils @@ -64,7 +65,11 @@ def before_all(context): os.environ['PAGER'] = ( f'{sys.executable} {os.path.join(context.package_root, "test/features/wrappager.py")} {context.conf["pager_boundary"]}' ) - context.conf["myclirc"] = os.path.join(context.package_root, "test", "myclirc") + source_myclirc = os.path.join(context.package_root, 'test', 'myclirc') + fd, context.myclirc_copy = tempfile.mkstemp(prefix='mycli-behave-', suffix='.myclirc') + os.close(fd) + shutil.copyfile(source_myclirc, context.myclirc_copy) + context.conf['myclirc'] = context.myclirc_copy context.cn = dbutils.create_db( context.conf["host"], context.conf["port"], context.conf["user"], context.conf["pass"], context.conf["dbname"] @@ -82,6 +87,10 @@ def after_all(context): os.remove(context.conf["defaults-file"]) except Exception: pass + try: + os.remove(context.myclirc_copy) + except FileNotFoundError: + pass # Restore env vars. # for k, v in context.pgenv.items():