Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix without_extras() for marker unions (python-poetry#415)
Browse files Browse the repository at this point in the history
* fix without_extras() for marker unions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2 people authored and bostonrwalker committed Aug 29, 2022
1 parent 0f7ae31 commit 043aee8
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/poetry/core/version/markers.py
Original file line number Diff line number Diff line change
@@ -734,9 +734,11 @@ def exclude(self, marker_name: str) -> BaseMarker:
continue

marker = m.exclude(marker_name)
new_markers.append(marker)

if not marker.is_empty():
new_markers.append(marker)
if not new_markers:
# All markers were the excluded marker.
return AnyMarker()

return self.of(*new_markers)

2 changes: 2 additions & 0 deletions tests/version/test_markers.py
Original file line number Diff line number Diff line change
@@ -905,6 +905,8 @@ def test_parse_version_like_markers(marker: str, env: dict[str, str]) -> None:
' "pypy" or extra == "bar"',
'python_version >= "3.6" or implementation_name == "pypy"',
),
('extra == "foo"', ""),
('extra == "foo" or extra == "bar"', ""),
],
)
def test_without_extras(marker: str, expected: str) -> None:

0 comments on commit 043aee8

Please sign in to comment.