From 55b73a7fe9cd170a3c2a557320ffc33634ad06f5 Mon Sep 17 00:00:00 2001 From: Marcel Bargull Date: Fri, 10 Nov 2023 18:28:36 +0100 Subject: [PATCH] Tests: Don't preset values for get_or_merge_config Otherwise default values set for testing_config before, e.g., environment variable-dependent config can be set in the tests. Example: tests/cli/test_main_build.py::test_conda_py_no_period failed since it sets CONDA_PY=36 but testing_config already had set it before. Signed-off-by: Marcel Bargull --- tests/conftest.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 945277f4c1..df4ec8e79e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -81,7 +81,7 @@ def testing_config(testing_workdir): def boolify(v): return v == "true" - result = Config( + testing_config_kwargs = dict( croot=testing_workdir, anaconda_upload=False, verbose=True, @@ -102,6 +102,8 @@ def boolify(v): exit_on_verify_error=exit_on_verify_error_default, conda_pkg_format=conda_pkg_format_default, ) + result = Config(**testing_config_kwargs) + result._testing_config_kwargs = testing_config_kwargs assert result.no_rewrite_stdout_env is False assert result._src_cache_root is None assert result.src_cache_root == testing_workdir @@ -121,7 +123,11 @@ def default_testing_config(testing_config, monkeypatch, request): return def get_or_merge_testing_config(config, variant=None, **kwargs): - return _get_or_merge_config(config or testing_config, variant, **kwargs) + merged_kwargs = {} + if not config: + merged_kwargs.update(testing_config._testing_config_kwargs) + merged_kwargs.update(kwargs) + return _get_or_merge_config(config, variant, **merged_kwargs) monkeypatch.setattr( conda_build.config,