From aeba4e05acc359152e41a46070877b65639d11b7 Mon Sep 17 00:00:00 2001 From: Amir MOHAMMADI <amir.mohammadi@idiap.ch> Date: Mon, 20 Jun 2022 19:56:26 +0200 Subject: [PATCH] Fix tests modifying the code's bobrc file --- bob/extension/rc_config.py | 1 + bob/extension/test_rc.py | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bob/extension/rc_config.py b/bob/extension/rc_config.py index b318f21..536a421 100644 --- a/bob/extension/rc_config.py +++ b/bob/extension/rc_config.py @@ -97,3 +97,4 @@ def _saverc(context): path = _get_rc_path() with open(path, "wt") as f: f.write(_rc_to_str(context)) + f.write("\n") diff --git a/bob/extension/test_rc.py b/bob/extension/test_rc.py index b20f342..74c57c0 100644 --- a/bob/extension/test_rc.py +++ b/bob/extension/test_rc.py @@ -74,8 +74,14 @@ def test_bob_config(): assert expected_output == result.output, result.output # test config unset (with starting substring) - result = runner.invoke(main_cli, ["config", "unset", "bob.db.atnt"]) - result = runner.invoke(main_cli, ["config", "get", "bob.db.atnt"]) + result = runner.invoke( + main_cli, + ["config", "unset", "bob.db.atnt"], + env={ENVNAME: bobrcfile}, + ) + result = runner.invoke( + main_cli, ["config", "get", "bob.db.atnt"], env={ENVNAME: bobrcfile} + ) assert_click_runner_result(result, 1) # test config unset (with substring contained) @@ -91,7 +97,11 @@ def test_bob_config(): env={ENVNAME: bobrcfile}, ) result = runner.invoke( - main_cli, ["config", "unset", "--contain", "atnt"] + main_cli, + ["config", "unset", "--contain", "atnt"], + env={ENVNAME: bobrcfile}, + ) + result = runner.invoke( + main_cli, ["config", "get", "bob.db.atnt"], env={ENVNAME: bobrcfile} ) - result = runner.invoke(main_cli, ["config", "get", "bob.db.atnt"]) assert_click_runner_result(result, 1) -- GitLab