From 83337e47869fdf1536ad4bccfbb52fe2a1f2bbf4 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sat, 26 Oct 2019 22:07:52 -0700 Subject: [PATCH] cfg: Fix test case failure due to incorrect path assumption When tmpdir fixture is used, the tests run in a separate directory instead of command execution directory. Any tests that take the current directory and assume that it contains files will fail. Fix this by taking the path relative to test module instead. Signed-off-by: Sunil Mohan Adapa --- plinth/tests/test_cfg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plinth/tests/test_cfg.py b/plinth/tests/test_cfg.py index 6f478b497..486aa84af 100644 --- a/plinth/tests/test_cfg.py +++ b/plinth/tests/test_cfg.py @@ -90,7 +90,8 @@ def test_read_primary_config_file(): def test_read_fallback_config_file(): """Verify that the correct fallback config file is used""" - fallback_root = os.path.realpath('.') + test_dir = os.path.dirname(os.path.realpath(__file__)) + fallback_root = os.path.realpath(os.path.join(test_dir, '..', '..')) fallback_config_file = os.path.join(fallback_root, 'plinth.config') config_path, root_directory = cfg.get_fallback_config_paths() cfg.read(config_path, root_directory)