Skip to content

Commit 16d0740

Browse files
committed
tests: make tests forwards compatible with poetry-core#851
1 parent ab12e13 commit 16d0740

File tree

2 files changed

+40
-3
lines changed

2 files changed

+40
-3
lines changed

tests/puzzle/test_solver.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2140,7 +2140,8 @@ def test_solver_duplicate_dependencies_with_overlapping_markers_complex(
21402140
)
21412141
opencv_requires = {dep.to_pep_508() for dep in ops[-1].package.requires}
21422142

2143-
assert opencv_requires == {
2143+
# before https://github.com/python-poetry/poetry-core/pull/851
2144+
expected1 = {
21442145
(
21452146
"numpy (>=1.21.2) ;"
21462147
' python_version >= "3.6" and platform_system == "Darwin"'
@@ -2170,6 +2171,38 @@ def test_solver_duplicate_dependencies_with_overlapping_markers_complex(
21702171
' or platform_system != "Linux" or platform_machine != "aarch64")'
21712172
),
21722173
}
2174+
# after https://github.com/python-poetry/poetry-core/pull/851
2175+
expected2 = {
2176+
(
2177+
"numpy (>=1.21.2) ;"
2178+
' platform_system == "Darwin" and platform_machine == "arm64"'
2179+
' and python_version >= "3.6" or python_version >= "3.10"'
2180+
),
2181+
(
2182+
'numpy (>=1.19.3) ; python_version >= "3.6" and python_version < "3.10"'
2183+
' and platform_system == "Linux" and platform_machine == "aarch64"'
2184+
' or python_version == "3.9" and platform_machine != "arm64"'
2185+
' or python_version == "3.9" and platform_system != "Darwin"'
2186+
),
2187+
(
2188+
'numpy (>=1.17.3) ; python_version == "3.8"'
2189+
' and (platform_system != "Darwin" or platform_machine != "arm64")'
2190+
' and (platform_system != "Linux" or platform_machine != "aarch64")'
2191+
),
2192+
(
2193+
'numpy (>=1.14.5) ; python_version == "3.7"'
2194+
' and (platform_system != "Darwin" or platform_machine != "arm64")'
2195+
' and (platform_system != "Linux" or platform_machine != "aarch64")'
2196+
),
2197+
(
2198+
'numpy (>=1.13.3) ; python_version < "3.7"'
2199+
' and (python_version < "3.6" or platform_system != "Darwin"'
2200+
' or platform_machine != "arm64") and (python_version < "3.6"'
2201+
' or platform_system != "Linux" or platform_machine != "aarch64")'
2202+
),
2203+
}
2204+
2205+
assert opencv_requires in (expected1, expected2)
21732206

21742207

21752208
def test_duplicate_path_dependencies(

tests/repositories/test_pypi_repository.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_package(
106106
]
107107
win_inet = package.extras[canonicalize_name("socks")][1]
108108
assert win_inet.name == "win-inet-pton"
109-
assert win_inet.python_versions == "~2.7 || ~2.6"
109+
assert win_inet.python_versions in {"~2.7 || ~2.6", ">=2.6 <2.8"}
110110

111111
# Different versions of poetry-core simplify the following marker differently,
112112
# either is fine.
@@ -118,7 +118,11 @@ def test_package(
118118
'sys_platform == "win32" and python_version == "2.7" and extra == "socks" or'
119119
' sys_platform == "win32" and python_version == "2.6" and extra == "socks"'
120120
)
121-
assert str(win_inet.marker) in {marker1, marker2}
121+
marker3 = (
122+
'sys_platform == "win32" and python_version >= "2.6" and python_version < '
123+
'"2.8" and extra == "socks"'
124+
)
125+
assert str(win_inet.marker) in {marker1, marker2, marker3}
122126

123127

124128
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)