Skip to content

Commit

Permalink
Add test for variants if using special selectors
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Bargull <marcel.bargull@udo.edu>
  • Loading branch information
mbargull committed Jan 16, 2024
1 parent c09b89c commit faeaf00
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package:
name: test_variant_implicit_via_special_selector
version: 1.0

build:
# "python" variant implicitly injected via "py" selector, but not explicit.
skip: true # [py<33]

outputs: # [with_outputs]
- name: test_variant_implicit_via_special_selector_subpackage # [with_outputs]
requirements: # [with_outputs]
host: # [with_outputs]
- python # [with_outputs]
14 changes: 14 additions & 0 deletions tests/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from conda_build import api, exceptions
from conda_build.utils import ensure_list, package_has_file
from conda_build.variants import (
PACKAGE_SELECTOR_MAP,
combine_specs,
dict_of_lists_to_list_of_dicts,
filter_combined_spec_to_used_keys,
Expand Down Expand Up @@ -660,6 +661,19 @@ def test_variant_subkeys_retained():
get_all_replacements(outputs[0][1].config.variant)


@pytest.mark.parametrize("with_outputs", [False, True])
def test_variant_implicit_via_special_selector(with_outputs):
ms = api.render(
os.path.join(variants_dir, "32_variant_implicit_via_special_selector"),
variants={"python": ["2.7", "3.3", "3.4"], "with_outputs": [with_outputs]},
finalize=False,
bypass_env_check=True,
)
assert sorted(m.config.variant["python"] for m, _, _ in ms) == ["3.3", "3.4"]
for m, _, _ in ms:
assert m.get_used_vars().intersection(PACKAGE_SELECTOR_MAP) == {"python"}


@pytest.mark.parametrize(
"internal_defaults, low_prio_config, high_prio_config, expected",
[
Expand Down

0 comments on commit faeaf00

Please sign in to comment.