Skip to content

Commit

Permalink
also deprecate transitive_python_constraint (#649)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby authored Oct 15, 2023
1 parent 4a60147 commit 542ecd1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/poetry/core/packages/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 4 additions & 1 deletion tests/packages/test_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 542ecd1

Please sign in to comment.