From 0c7c4b12fb987338a80c6c21de0602fbc8856e10 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 28 Jun 2020 17:25:47 -0700 Subject: [PATCH] tests: Use develop configuration for most tests - Use the test configuration only when needed. This simplifies having to load test configuration properly for action tests. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- conftest.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/conftest.py b/conftest.py index 3f1eaf5ac..6b8cb0ce7 100644 --- a/conftest.py +++ b/conftest.py @@ -50,12 +50,21 @@ def fixture_load_cfg(): """Load test configuration.""" from plinth import cfg + keys = ('file_root', 'config_dir', 'data_dir', 'custom_static_dir', + 'store_file', 'actions_dir', 'doc_dir', 'server_dir', 'host', + 'port', 'use_x_forwarded_for', 'use_x_forwarded_host', + 'secure_proxy_ssl_header', 'box_name', 'develop') + saved_state = {} + for key in keys: + saved_state[key] = getattr(cfg, key) + root_dir = pathlib.Path(__file__).resolve().parent - test_data_dir = root_dir / 'plinth' / 'tests' / 'data' - cfg_file = test_data_dir / 'configs' / 'freedombox.config' + cfg_file = root_dir / 'plinth' / 'develop.config' cfg.read_file(str(cfg_file)) yield cfg - cfg.read_file(str(cfg_file)) + + for key in keys: + setattr(cfg, key, saved_state[key]) @pytest.fixture(name='develop_mode')