Skip to content

Commit a868643

Browse files
committed
fix(test): Fix failure due to different uname.machine on linux vs darwin
PR #832 added a test case that relies on `platform.machine()` results. The stdlib function returns different values on aarch64 for Darwin and Linux. On Linux, it returns `aarch64`, on Darwin - `arm64`. It broke the test suite for `aarch64-linux` users. This patch makes the test case handle both values. Note: the test will still fail on platforms other than x86_64 or aarch64.
1 parent d3ca6c0 commit a868643

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tests/test_constraints.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,14 @@ def test_add_constraint_conflict():
5858

5959
# Different, but equivalent markers should raise KeyError
6060
with pytest.raises(KeyError):
61-
c.add_constraint(
62-
"bar==1.0; python_version >= '3.11' and platform_machine == 'x86_64'"
63-
)
64-
c.add_constraint(
65-
"bar==1.1; platform_machine == 'x86_64' and python_version >= '3.11'"
66-
)
67-
c.add_constraint(
68-
"bar==1.0; python_version >= '3.11' and platform_machine == 'arm64'"
69-
)
70-
c.add_constraint(
71-
"bar==1.1; platform_machine == 'arm64' and python_version >= '3.11'"
72-
)
61+
# arm64 -> macos; aarch64 -> linux
62+
for arch in ["x86_64", "arm64", "aarch64"]:
63+
c.add_constraint(
64+
f"bar==1.0; python_version >= '3.11' and platform_machine == '{arch}'"
65+
)
66+
c.add_constraint(
67+
f"bar==1.1; platform_machine == '{arch}' and python_version >= '3.11'"
68+
)
7369

7470
# Same package with different markers should NOT raise error
7571
c.add_constraint("baz==1.0; platform_machine != 'ppc64le'")

0 commit comments

Comments
 (0)