Skip to content

Commit 2092487

Browse files
committed
Add test
1 parent 77e65a3 commit 2092487

1 file changed

Lines changed: 40 additions & 40 deletions

File tree

tests/python/python_tests.bzl

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,45 @@ def _test_single_version_platform_override_errors(env):
827827
_tests.append(_test_single_version_platform_override_errors)
828828

829829
def _test_single_version_platform_override_from_env(env):
830+
py = parse_modules(
831+
module_ctx = _mock_mctx(
832+
_mod(
833+
name = "my_module",
834+
toolchain = [_toolchain("3.13")],
835+
single_version_platform_override = [
836+
_single_version_platform_override(
837+
platform = "aarch64-unknown-linux-gnu",
838+
python_version_env = "PYTHON_VERSION_ENV",
839+
sha256_env = "SHA256_ENV",
840+
strip_prefix_env = "STRIP_PREFIX_ENV",
841+
url_env = "URL_ENV",
842+
),
843+
],
844+
override = [
845+
_override(
846+
available_python_versions = ["3.13.99"],
847+
),
848+
],
849+
),
850+
environ = {
851+
"PYTHON_VERSION_ENV": "3.13.99",
852+
"SHA256_ENV": "deadbeef",
853+
"STRIP_PREFIX_ENV": "my-prefix",
854+
"URL_ENV": "example.com,example.org",
855+
},
856+
),
857+
logger = repo_utils.logger(verbosity_level = 0, name = "python"),
858+
)
859+
860+
env.expect.that_dict(py.config.default["tool_versions"]["3.13.99"]).contains_exactly({
861+
"sha256": {"aarch64-unknown-linux-gnu": "deadbeef"},
862+
"strip_prefix": {"aarch64-unknown-linux-gnu": "my-prefix"},
863+
"url": {"aarch64-unknown-linux-gnu": ["example.com", "example.org"]},
864+
})
865+
866+
_tests.append(_test_single_version_platform_override_from_env)
867+
868+
def _test_single_version_platform_override_from_env_minor_version(env):
830869
py = parse_modules(
831870
module_ctx = _mock_mctx(
832871
_mod(
@@ -863,46 +902,7 @@ def _test_single_version_platform_override_from_env(env):
863902
"url": {"aarch64-unknown-linux-gnu": ["example.com", "example.org"]},
864903
})
865904

866-
_tests.append(_test_single_version_platform_override_from_env)
867-
868-
# def _test_single_version_platform_override_from_env_minor_version(env):
869-
# py = parse_modules(
870-
# module_ctx = _mock_mctx(
871-
# _mod(
872-
# name = "my_module",
873-
# toolchain = [_toolchain("3.13")],
874-
# single_version_platform_override = [
875-
# _single_version_platform_override(
876-
# platform = "aarch64-unknown-linux-gnu",
877-
# python_version_env = "PYTHON_VERSION_ENV",
878-
# sha256_env = "SHA256_ENV",
879-
# strip_prefix_env = "STRIP_PREFIX_ENV",
880-
# url_env = "URL_ENV",
881-
# ),
882-
# ],
883-
# override = [
884-
# _override(
885-
# available_python_versions = ["3.13.6"],
886-
# ),
887-
# ],
888-
# ),
889-
# environ = {
890-
# "PYTHON_VERSION_ENV": "3.13",
891-
# "SHA256_ENV": "deadbeef",
892-
# "STRIP_PREFIX_ENV": "my-prefix",
893-
# "URL_ENV": "example.com,example.org",
894-
# },
895-
# ),
896-
# logger = repo_utils.logger(verbosity_level = 0, name = "python"),
897-
# )
898-
899-
# env.expect.that_dict(py.config.default["tool_versions"]["3.13.6"]).contains_exactly({
900-
# "sha256": {"aarch64-unknown-linux-gnu": "deadbeef"},
901-
# "strip_prefix": {"aarch64-unknown-linux-gnu": "my-prefix"},
902-
# "url": {"aarch64-unknown-linux-gnu": ["example.com", "example.org"]},
903-
# })
904-
905-
# _tests.append(_test_single_version_platform_override_from_env_minor_version)
905+
_tests.append(_test_single_version_platform_override_from_env_minor_version)
906906

907907
# TODO @aignas 2024-09-03: add failure tests:
908908
# * incorrect platform failure

0 commit comments

Comments
 (0)