Skip to content

Commit

Permalink
Fix testing config monkeypatch for concurrent test flakiness
Browse files Browse the repository at this point in the history
The default_testing_config monkeypatching fixture was added in gh-4653
but did not consider "from .config import get_or_merge_config" cases in
which get_or_merge_config is already bound and thus not patched.

Signed-off-by: Marcel Bargull <[email protected]>
  • Loading branch information
mbargull committed Nov 10, 2023
1 parent d1b96db commit 1d481d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions conda_build/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -913,8 +913,7 @@ def __exit__(self, e_type, e_value, traceback):
self.clean(remove_folders=False)


def get_or_merge_config(config, variant=None, **kwargs):
"""Always returns a new object - never changes the config that might be passed in."""
def _get_or_merge_config(config, variant=None, **kwargs):
if not config:
config = Config(variant=variant)
else:
Expand All @@ -928,6 +927,11 @@ def get_or_merge_config(config, variant=None, **kwargs):
return config


def get_or_merge_config(config, variant=None, **kwargs):
"""Always returns a new object - never changes the config that might be passed in."""
return _get_or_merge_config(config, variant=variant, **kwargs)


def get_channel_urls(args):
channel_urls = args.get("channel") or args.get("channels") or ()
final_channel_urls = []
Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import conda_build.config
from conda_build.config import (
Config,
_get_or_merge_config,
_src_cache_root_default,
conda_pkg_format_default,
enable_static_default,
error_overdepending_default,
error_overlinking_default,
exit_on_verify_error_default,
filename_hashing_default,
get_or_merge_config,
ignore_verify_codes_default,
no_rewrite_stdout_env_default,
noarch_python_build_age_default,
Expand Down Expand Up @@ -121,11 +121,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)
return _get_or_merge_config(config or testing_config, variant, **kwargs)

monkeypatch.setattr(
conda_build.config,
"get_or_merge_config",
"_get_or_merge_config",
get_or_merge_testing_config,
)

Expand Down

0 comments on commit 1d481d5

Please sign in to comment.