From 1007cfe9e861a4180715da23af7fc7bbd6a7d6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Randy=20D=C3=B6ring?= <30527984+radoering@users.noreply.github.com> Date: Sat, 25 Jan 2025 12:52:10 +0100 Subject: [PATCH] tests: adapt tests to cosmetic changes caused by poetry-core#826 --- poetry.lock | 8 +- pyproject.toml | 2 +- .../fixtures/update-with-locked-extras.test | 4 +- .../fixtures/with-multiple-updates.test | 4 +- tests/puzzle/test_solver.py | 96 ++++++------------- tests/puzzle/test_solver_internals.py | 5 +- 6 files changed, 41 insertions(+), 78 deletions(-) diff --git a/poetry.lock b/poetry.lock index 87941004c83..54886d3596d 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1050,9 +1050,9 @@ develop = false [package.source] type = "git" -url = "https://github.com/python-poetry/poetry-core.git" -reference = "HEAD" -resolved_reference = "d97577e664d59173482a78f70e8f743cc5468851" +url = "https://github.com/radoering/poetry-core.git" +reference = "simplify-python-marker" +resolved_reference = "c98501e102877c7aa406bdb16bbf2e56f921fdcf" [[package]] name = "pre-commit" @@ -1739,4 +1739,4 @@ type = ["pytest-mypy"] [metadata] lock-version = "2.1" python-versions = ">=3.9,<4.0" -content-hash = "e12eda5cc53996f463234f41ff013a8b0aa972ffbcbe210197327660d88b0af1" +content-hash = "0cdc3388ac6cab9d6f4884a917f42bd9692f8a612bd9832eb12cfbbf02ffc7e5" diff --git a/pyproject.toml b/pyproject.toml index f86eee304d6..aa1f8802814 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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)", diff --git a/tests/installation/fixtures/update-with-locked-extras.test b/tests/installation/fixtures/update-with-locked-extras.test index e70f409c56e..567b22aee24 100644 --- a/tests/installation/fixtures/update-with-locked-extras.test +++ b/tests/installation/fixtures/update-with-locked-extras.test @@ -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"] @@ -30,7 +30,7 @@ description = "" optional = false python-versions = "*" groups = ["main"] -markers = 'python_version < "2.8"' +markers = 'python_version == "2.7"' files = [] [[package]] diff --git a/tests/installation/fixtures/with-multiple-updates.test b/tests/installation/fixtures/with-multiple-updates.test index 28c270323f2..434721368c7 100644 --- a/tests/installation/fixtures/with-multiple-updates.test +++ b/tests/installation/fixtures/with-multiple-updates.test @@ -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\""}, ] @@ -30,7 +30,7 @@ description = "" optional = false python-versions = "*" groups = ["main"] -markers = 'python_version < "2.8"' +markers = 'python_version == "2.7"' files = [] [[package]] diff --git a/tests/puzzle/test_solver.py b/tests/puzzle/test_solver.py index 205972a8848..da366d1bd36 100644 --- a/tests/puzzle/test_solver.py +++ b/tests/puzzle/test_solver.py @@ -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( diff --git a/tests/puzzle/test_solver_internals.py b/tests/puzzle/test_solver_internals.py index 5a9effd8972..9cfbac30da6 100644 --- a/tests/puzzle/test_solver_internals.py +++ b/tests/puzzle/test_solver_internals.py @@ -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"' }