diff --git a/examples/customize_controls/construct.yaml b/examples/customize_controls/construct.yaml index d7c0eea8..aae91d0f 100644 --- a/examples/customize_controls/construct.yaml +++ b/examples/customize_controls/construct.yaml @@ -11,3 +11,4 @@ specs: register_python: False initialize_conda: False +initialize_by_default: false diff --git a/examples/osxpkg/construct.yaml b/examples/osxpkg/construct.yaml index e3961867..d10fb6ed 100644 --- a/examples/osxpkg/construct.yaml +++ b/examples/osxpkg/construct.yaml @@ -10,6 +10,7 @@ channels: - http://repo.anaconda.com/pkgs/main/ attempt_hardlinks: True +initialize_by_default: false specs: - python diff --git a/examples/use_channel_remap/construct.yaml b/examples/use_channel_remap/construct.yaml index e1275a5f..fbd3fe58 100644 --- a/examples/use_channel_remap/construct.yaml +++ b/examples/use_channel_remap/construct.yaml @@ -18,3 +18,4 @@ specs: - conda license_file: eula.txt +initialize_by_default: false diff --git a/news/709-test-import-fixes b/news/709-test-import-fixes new file mode 100644 index 00000000..8c821153 --- /dev/null +++ b/news/709-test-import-fixes @@ -0,0 +1,19 @@ +### Enhancements + +* + +### Bug fixes + +* Fix imports and skips for constructor tests. (#709) + +### Deprecations + +* + +### Docs + +* + +### Other + +* diff --git a/tests/test_examples.py b/tests/test_examples.py index 4bd862a3..0fb9cf4f 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -13,7 +13,8 @@ from conda.base.context import context from conda.core.prefix_data import PrefixData -from constructor.osxpkg import calculate_install_dir +if sys.platform == "darwin": + from constructor.osxpkg import calculate_install_dir try: import coverage # noqa @@ -349,7 +350,7 @@ def test_example_noconda(tmp_path, request): _run_installer(input_path, installer, install_dir, request=request) -@pytest.mark.skipif(sys.platform != "Darwin", reason="macOS only") +@pytest.mark.skipif(sys.platform != "darwin", reason="macOS only") def test_example_osxpkg(tmp_path, request): input_path = _example_path("osxpkg") for installer, install_dir in create_installer(input_path, tmp_path): diff --git a/tests/test_header.py b/tests/test_header.py index bc5b42bb..725fe607 100644 --- a/tests/test_header.py +++ b/tests/test_header.py @@ -1,5 +1,6 @@ import itertools import subprocess +import sys import tempfile from functools import lru_cache from pathlib import Path @@ -7,7 +8,11 @@ import pytest -from constructor.osxpkg import OSX_DIR +if sys.platform == "darwin": + from constructor.osxpkg import OSX_DIR +else: + # Tests with OSX_DIR are skipped, but a placeholder is needed for pytest + OSX_DIR = "" from constructor.shar import read_header_template from constructor.utils import preprocess @@ -95,6 +100,7 @@ def test_linux_template_processing(): assert not errors +@pytest.mark.skipif(sys.platform != "darwin", reason="Only on MacOS") @pytest.mark.parametrize("arch", ["x86_64", "arm64"]) @pytest.mark.parametrize("check_path_spaces", [False, True]) @pytest.mark.parametrize("script", sorted(Path(OSX_DIR).glob("*.sh"))) @@ -107,6 +113,7 @@ def test_osxpkg_scripts_template_processing(arch, check_path_spaces, script): assert "#endif" not in processed +@pytest.mark.skipif(sys.platform != "darwin", reason="Only on MacOS") @pytest.mark.skipif(available_command("shellcheck") is False, reason="requires shellcheck") @pytest.mark.parametrize("arch", ["x86_64", "arm64"]) @pytest.mark.parametrize("check_path_spaces", [False, True])