Skip to content

chore: use pytest's new strict mode and fix duplicate tests#10847

Merged
radoering merged 1 commit intopython-poetry:mainfrom
radoering:pytest-strict
Apr 18, 2026
Merged

chore: use pytest's new strict mode and fix duplicate tests#10847
radoering merged 1 commit intopython-poetry:mainfrom
radoering:pytest-strict

Conversation

@radoering
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • In test_peeled_tag the parametrized tag argument is immediately overwritten (tag = peeled_tag("my-tag")), so the parameter (and new ids) are effectively unused; consider either asserting behavior that depends on the input type or removing the parametrize and hard-coding the value to keep the test intention clear.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `test_peeled_tag` the parametrized `tag` argument is immediately overwritten (`tag = peeled_tag("my-tag")`), so the parameter (and new `ids`) are effectively unused; consider either asserting behavior that depends on the input type or removing the parametrize and hard-coding the value to keep the test intention clear.

## Individual Comments

### Comment 1
<location path="tests/vcs/git/test_backend.py" line_range="105" />
<code_context>


[email protected](("tag"), ["my-tag", b"my-tag"])
[email protected]("tag", ["my-tag", b"my-tag"], ids=["str", "bytes"])
 def test_peeled_tag(tag: str | bytes) -> None:
     tag = peeled_tag("my-tag")
</code_context>
<issue_to_address>
**issue (testing):** Use the parametrized `tag` value inside the test to actually exercise both `str` and `bytes` inputs.

Right now `test_peeled_tag` ignores the parametrized `tag` and always calls `peeled_tag("my-tag")`, so it never exercises the bytes path. Use the parameter in the call, e.g.

```python
@pytest.mark.parametrize("tag", ["my-tag", b"my-tag"], ids=["str", "bytes"])
def test_peeled_tag(tag: str | bytes) -> None:
    result = peeled_tag(tag)
    assert result == b"my-tag^{}"  # or the correct expected value
```

so the parametrization actually validates both input types and protects against regressions in their handling.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/vcs/git/test_backend.py
@radoering radoering merged commit e05e7a6 into python-poetry:main Apr 18, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant