diff --git a/src/poetry/core/packages/utils/utils.py b/src/poetry/core/packages/utils/utils.py index 1440d57b9..708746d08 100644 --- a/src/poetry/core/packages/utils/utils.py +++ b/src/poetry/core/packages/utils/utils.py @@ -274,7 +274,7 @@ def create_nested_marker( padding = ".0" * (3 - version.precision) part = f'python_full_version > "{version}{padding}"' else: - part = f'{min_name} {op} "{version}"' + part = f'{min_name} {op} "{version.stable}"' parts.append(part) @@ -292,7 +292,7 @@ def create_nested_marker( padding = ".0" * (3 - version.precision) part = f'python_full_version <= "{version}{padding}"' else: - part = f'{max_name} {op} "{version}"' + part = f'{max_name} {op} "{version.stable}"' parts.append(part) diff --git a/tests/packages/utils/test_utils.py b/tests/packages/utils/test_utils.py index 87dc0beb3..f1cbd2317 100644 --- a/tests/packages/utils/test_utils.py +++ b/tests/packages/utils/test_utils.py @@ -150,6 +150,12 @@ def test_create_nested_marker_base_constraint(constraint: str, expected: str) -> ' or (python_version >= "3.9" and python_full_version <= "3.10.0")' ), ), + # wildcard + ("3.*", 'python_version >= "3" and python_version < "4"'), + ("3.9.*", 'python_version >= "3.9" and python_version < "3.10"'), + ("3.*,>=3.9", 'python_version >= "3.9" and python_version < "4"'), + ("3.*,>=3.9.0", 'python_full_version >= "3.9.0" and python_version < "4"'), + ("3.*,>=3.9.1", 'python_full_version >= "3.9.1" and python_version < "4"'), ], ) def test_create_nested_marker_version_constraint(