From 542ecd1cf079619af4147c0f42611bf7d998c0ea Mon Sep 17 00:00:00 2001 From: David Hotham Date: Sun, 15 Oct 2023 17:59:52 +0200 Subject: [PATCH] also deprecate transitive_python_constraint (#649) --- src/poetry/core/packages/dependency.py | 5 +++++ tests/packages/test_dependency.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/poetry/core/packages/dependency.py b/src/poetry/core/packages/dependency.py index cd66a9be0..f5f559a85 100644 --- a/src/poetry/core/packages/dependency.py +++ b/src/poetry/core/packages/dependency.py @@ -219,6 +219,11 @@ def python_constraint(self) -> VersionConstraint: @property def transitive_python_constraint(self) -> VersionConstraint: + warnings.warn( + "'transitive_python_constraint' is deprecated and will be removed.", + DeprecationWarning, + stacklevel=2, + ) if self._transitive_python_constraint is None: return self._python_constraint diff --git a/tests/packages/test_dependency.py b/tests/packages/test_dependency.py index dfa4cd6b0..96c57c5a4 100644 --- a/tests/packages/test_dependency.py +++ b/tests/packages/test_dependency.py @@ -321,7 +321,10 @@ def test_with_constraint() -> None: assert new.marker == dependency.marker assert new.transitive_marker == dependency.transitive_marker assert new.python_constraint == dependency.python_constraint - assert new.transitive_python_constraint == dependency.transitive_python_constraint + with pytest.warns(DeprecationWarning): + assert ( + new.transitive_python_constraint == dependency.transitive_python_constraint + ) @pytest.mark.parametrize(