Skip to content

tests: make tests forwards compatible with poetry-core#851 #10274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,8 @@ def test_solver_duplicate_dependencies_with_overlapping_markers_complex(
)
opencv_requires = {dep.to_pep_508() for dep in ops[-1].package.requires}

assert opencv_requires == {
# before https://github.com/python-poetry/poetry-core/pull/851
expected1 = {
(
"numpy (>=1.21.2) ;"
' python_version >= "3.6" and platform_system == "Darwin"'
Expand Down Expand Up @@ -2170,6 +2171,38 @@ def test_solver_duplicate_dependencies_with_overlapping_markers_complex(
' or platform_system != "Linux" or platform_machine != "aarch64")'
),
}
# after https://github.com/python-poetry/poetry-core/pull/851
expected2 = {
(
"numpy (>=1.21.2) ;"
' platform_system == "Darwin" and platform_machine == "arm64"'
' and python_version >= "3.6" or python_version >= "3.10"'
),
(
'numpy (>=1.19.3) ; python_version >= "3.6" and python_version < "3.10"'
' and platform_system == "Linux" and platform_machine == "aarch64"'
' or python_version == "3.9" and platform_machine != "arm64"'
' or python_version == "3.9" and platform_system != "Darwin"'
),
(
'numpy (>=1.17.3) ; python_version == "3.8"'
' and (platform_system != "Darwin" or platform_machine != "arm64")'
' and (platform_system != "Linux" or platform_machine != "aarch64")'
),
(
'numpy (>=1.14.5) ; python_version == "3.7"'
' and (platform_system != "Darwin" or platform_machine != "arm64")'
' and (platform_system != "Linux" or platform_machine != "aarch64")'
),
(
'numpy (>=1.13.3) ; python_version < "3.7"'
' and (python_version < "3.6" or platform_system != "Darwin"'
' or platform_machine != "arm64") and (python_version < "3.6"'
' or platform_system != "Linux" or platform_machine != "aarch64")'
),
}

assert opencv_requires in (expected1, expected2)


def test_duplicate_path_dependencies(
Expand Down
8 changes: 6 additions & 2 deletions tests/repositories/test_pypi_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_package(
]
win_inet = package.extras[canonicalize_name("socks")][1]
assert win_inet.name == "win-inet-pton"
assert win_inet.python_versions == "~2.7 || ~2.6"
assert win_inet.python_versions in {"~2.7 || ~2.6", ">=2.6 <2.8"}

# Different versions of poetry-core simplify the following marker differently,
# either is fine.
Expand All @@ -118,7 +118,11 @@ def test_package(
'sys_platform == "win32" and python_version == "2.7" and extra == "socks" or'
' sys_platform == "win32" and python_version == "2.6" and extra == "socks"'
)
assert str(win_inet.marker) in {marker1, marker2}
marker3 = (
'sys_platform == "win32" and python_version >= "2.6" and python_version < '
'"2.8" and extra == "socks"'
)
assert str(win_inet.marker) in {marker1, marker2, marker3}


@pytest.mark.parametrize(
Expand Down
Loading