Skip to content

Commit

Permalink
tests: adapt tests to cosmetic changes caused by poetry-core#826
Browse files Browse the repository at this point in the history
  • Loading branch information
radoering committed Jan 25, 2025
1 parent ecc2697 commit 1007cfe
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 78 deletions.
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "2.0.1"
description = "Python dependency management and packaging made easy."
requires-python = ">=3.9,<4.0"
dependencies = [
"poetry-core @ git+https://github.com/python-poetry/poetry-core.git",
"poetry-core @ git+https://github.com/radoering/poetry-core.git@simplify-python-marker",
"build (>=1.2.1,<2.0.0)",
"cachecontrol[filecache] (>=0.14.0,<0.15.0)",
"cleo (>=2.1.0,<3.0.0)",
Expand Down
4 changes: 2 additions & 2 deletions tests/installation/fixtures/update-with-locked-extras.test
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ files = []

[package.dependencies]
"B" = {version = "^1.0", optional = true}
"C" = {version = "^1.0", markers = "python_version >= \"2.7\" and python_version < \"2.8\""}
"C" = {version = "^1.0", markers = "python_version == \"2.7\""}

[package.extras]
foo = ["B"]
Expand All @@ -30,7 +30,7 @@ description = ""
optional = false
python-versions = "*"
groups = ["main"]
markers = 'python_version < "2.8"'
markers = 'python_version == "2.7"'
files = []

[[package]]
Expand Down
4 changes: 2 additions & 2 deletions tests/installation/fixtures/with-multiple-updates.test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ files = []
[package.dependencies]
B = ">=1.0.1"
C = [
{version = ">=1.0,<2.0", markers = "python_version >= \"2.7\" and python_version < \"2.8\""},
{version = ">=1.0,<2.0", markers = "python_version == \"2.7\""},
{version = ">=2.0,<3.0", markers = "python_version >= \"3.4\" and python_version < \"4.0\""},
]

Expand All @@ -30,7 +30,7 @@ description = ""
optional = false
python-versions = "*"
groups = ["main"]
markers = 'python_version < "2.8"'
markers = 'python_version == "2.7"'
files = []

[[package]]
Expand Down
96 changes: 31 additions & 65 deletions tests/puzzle/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1989,71 +1989,37 @@ def test_solver_duplicate_dependencies_with_overlapping_markers_complex(
],
)
opencv_requires = {dep.to_pep_508() for dep in ops[-1].package.requires}
expectation = (
{ # concise solution, but too expensive
(
"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.9" and python_version < "3.10"'
' and platform_system != "Darwin" or platform_system == "Linux"'
' and platform_machine == "aarch64" and python_version < "3.10"'
' and python_version >= "3.6" or python_version >= "3.9"'
' and python_version < "3.10" and platform_machine != "arm64"'
),
(
'numpy (>=1.17.3) ; python_version >= "3.8" and python_version < "3.9"'
' 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 python_version < "3.8"'
' 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")'
),
},
{ # current solution
(
"numpy (>=1.21.2) ;"
' python_version >= "3.6" and platform_system == "Darwin"'
' and platform_machine == "arm64" or python_version >= "3.10"'
),
(
'numpy (>=1.19.3) ; python_version >= "3.6"'
' and (platform_system == "Linux" or python_version >= "3.9")'
' and python_version < "3.10"'
' and (platform_system != "Darwin" or platform_machine != "arm64")'
' and (platform_machine == "aarch64" or python_version >= "3.9")'
),
(
'numpy (>=1.17.3) ; python_version < "3.9"'
' and (platform_system != "Darwin" or platform_machine != "arm64")'
' and python_version >= "3.8"'
' and (platform_system != "Linux" or platform_machine != "aarch64")'
),
(
'numpy (>=1.14.5) ; python_version < "3.8"'
' and (platform_system != "Darwin" or platform_machine != "arm64")'
' and python_version >= "3.7"'
' 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 expectation

assert opencv_requires == {
(
"numpy (>=1.21.2) ;"
' python_version >= "3.6" and platform_system == "Darwin"'
' and platform_machine == "arm64" or python_version >= "3.10"'
),
(
'numpy (>=1.19.3) ; platform_system == "Linux"'
' and platform_machine == "aarch64" and python_version < "3.10"'
' and python_version >= "3.6" or python_version == "3.9"'
' and platform_system != "Darwin" or python_version == "3.9"'
' and platform_machine != "arm64"'
),
(
'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")'
),
}


def test_duplicate_path_dependencies(
Expand Down
5 changes: 1 addition & 4 deletions tests/puzzle/test_solver_internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,10 +450,7 @@ def test_merge_override_packages_multiple_deps(package: ProjectPackage) -> None:
assert len(packages) == 1
assert packages[a].groups == {"main"}
assert tm(packages[a]) == {
"main": (
'python_version < "3.9" and sys_platform == "linux"'
' and python_version >= "3.8"'
)
"main": 'python_version == "3.8" and sys_platform == "linux"'
}


Expand Down

0 comments on commit 1007cfe

Please sign in to comment.