Skip to content

Commit adf7141

Browse files
committed
don't skip tests for invalid combinations; ensure they too have at most 1 pin
1 parent ee2a849 commit adf7141

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

setup.cfg

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ install_requires =
1919
# tests for this package.
2020

2121
# AIX requires fixes contained in numpy 1.16
22-
numpy==1.16.0; python_version=='3.7' and platform_system=='AIX'
22+
numpy==1.16.0; python_version=='3.7' and platform_system=='AIX' and platform_machine!='loongarch64' and platform_python_implementation != 'PyPy'
2323

2424
# IBM i requires fixes contained in numpy 1.23.3. Only Python 3.6 and 3.9
2525
# are supported on IBM i system, so we're ignoring other Python versions here
2626
# for simplicity (see gh-66).
27-
numpy==1.23.3; python_version=='3.9' and platform_system=='OS400'
27+
numpy==1.23.3; python_version=='3.9' and platform_system=='OS400' and platform_machine!='loongarch64'
2828

2929
# numpy 1.19 was the first minor release to provide aarch64 wheels, but
3030
# wheels require fixes contained in numpy 1.19.2
31-
numpy==1.19.2; python_version=='3.7' and platform_machine=='aarch64' and platform_python_implementation != 'PyPy'
31+
numpy==1.19.2; python_version=='3.7' and platform_machine=='aarch64' and platform_system!='AIX' and platform_python_implementation != 'PyPy'
3232
numpy==1.19.2; python_version=='3.8' and platform_machine=='aarch64' and platform_python_implementation != 'PyPy'
3333

3434
# arm64 on Darwin supports Python 3.8 and above requires numpy>=1.21.0
3535
# (first version with arm64 wheels available)
36-
numpy==1.21.0; python_version=='3.7' and platform_machine=='arm64' and platform_system=='Darwin'
37-
numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin'
36+
numpy==1.21.0; python_version=='3.7' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation!='PyPy'
37+
numpy==1.21.0; python_version=='3.8' and platform_machine=='arm64' and platform_system=='Darwin' and platform_python_implementation!='PyPy'
3838
numpy==1.21.0; python_version=='3.9' and platform_machine=='arm64' and platform_system=='Darwin'
3939

4040
# Python 3.8 on s390x requires at least 1.17.5, see gh-29

tests/test_dependencies.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def test_has_at_most_one_pinned_dependency(
2626
):
2727
# These are known to be platforms that are not valid / possible at this time.
2828
# due the the sheer variety, the default assumption is that a given combination
29-
# is invalid (and thus skipped), allowing us to specify valid cases more easily
29+
# is invalid, allowing us to specify valid cases more easily below
3030
valid = False
3131
match (platform_system, platform_machine):
3232
case ["Linux", "arm64"]:
@@ -39,8 +39,6 @@ def test_has_at_most_one_pinned_dependency(
3939
valid = True
4040
case [("AIX" | "OS400"), ("x86" | "x86_64" | "s390x")]:
4141
valid = True
42-
if not valid:
43-
pytest.skip(f"{platform_system} and {platform_machine} are mutually exclusive.")
4442

4543
# currently linux-{64, aarch64, ppc64le}, osx-64, win-64; no support for arm64 yet
4644
pypy_pairs = [
@@ -52,10 +50,11 @@ def test_has_at_most_one_pinned_dependency(
5250
]
5351
if (platform_python_implementation == "PyPy"
5452
and (platform_system, platform_machine) not in pypy_pairs):
55-
pytest.skip(f"PyPy is not supported on {platform_system}/{platform_machine}.")
53+
valid = False
5654

5755
if platform_system == "OS400" and python_version != "3.9":
58-
pytest.skip(f"IBMi only supported on Python {python_version}.")
56+
# IBMi only supported on CPython 3.9, see gh-66
57+
valid = False
5958

6059
environment = {
6160
"python_version": python_version,
@@ -104,10 +103,17 @@ def test_has_at_most_one_pinned_dependency(
104103
case ["Windows", "arm64"]:
105104
expect_pin = True
106105

107-
# we only expect a pin for released python versions
108-
expect_pin = False if (python_version == "3.12") else expect_pin
109-
# also check that cases with expect_pin==False should _not_ have a pin
110-
log_msg = "Expected " + ("exactly one pin" if expect_pin else "no pins")
111-
assert (
112-
len(filtered_requirements) == int(expect_pin)
113-
), f"{log_msg}.\n{pprint.pformat(environment)}"
106+
# for valid combinations, we test more strictly: expect exactly zero or one pins
107+
if valid:
108+
# we only expect a pin for released python versions
109+
expect_pin = False if (python_version == "3.12") else expect_pin
110+
log_msg = "Expected " + ("exactly one pin" if expect_pin else "no pins")
111+
assert (
112+
len(filtered_requirements) == int(expect_pin)
113+
), f"{log_msg}.\n{pprint.pformat(environment)}"
114+
else:
115+
# on invalid platform / interpreter combinations, test
116+
# that at least we do not produce more than one pin
117+
assert (
118+
len(filtered_requirements) <= 1
119+
), f"Expected no more than one pin.\n{pprint.pformat(environment)}"

0 commit comments

Comments
 (0)