Skip to content

Commit

Permalink
Tests: Don't preset values for get_or_merge_config
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mbargull committed Nov 10, 2023
1 parent 95f8085 commit 55b73a7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 55b73a7

Please sign in to comment.