Skip to content

Conversation

@henryiii
Copy link
Contributor

Found several issues: duplicated test cases (second commit), and test code that never ran (and was incorrect) (third commit). The final commit improves the tests by making sure the ValueError's raised are correct.

  • chore: autofixes from ruff PT
  • chore: duplicated cases from PT014
  • chore: test code was not running from PT012
  • chore: finish ruff PT, with pytest.raises matchers

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
@henryiii
Copy link
Contributor Author

henryiii commented Nov 11, 2025

CC @notatallshaw for eddb655 (I think).

@notatallshaw
Copy link
Member

notatallshaw commented Nov 12, 2025

@henryiii ah, thanks for the duplication catches, I went through several rounds of adding more tests and just coming up with any edge case I could, so it doesn't surprise me a few were duplicates.

I added this group for pip (pypa/pip#12894), I do think it's worth going the lint.flake8-pytest-style options and making sure you agree with each of them or think some are worth changing from the defaults.

@henryiii
Copy link
Contributor Author

I do disagree with some of the PT checks; I was assuming we could turn them off if they came up in the future. "PT013" is incorrect if you want to import classes for typing (and IMO, from pytest import approx is fine). Several of the ones I strongly disagree with, like PT004, have been disabled so they no longer trigger for anyone.

@henryiii
Copy link
Contributor Author

henryiii commented Nov 12, 2025

And I do like the tuple better than csv for multiple parameters in parametrization; I think most of us picked up the csv style from old examples. I think that's the only one significantly different than the defaults in that PR.

@notatallshaw
Copy link
Member

And I do like the tuple better than csv for multiple parameters in parametrization

Yeah, I chose the setting for pip, including setting csv, based on keeping the diff as small as possible for the PR, I wasn't advocating for the same choices I made in that PR, just that it's worth reviewing the options.

@henryiii henryiii merged commit bdc4b94 into pypa:main Nov 12, 2025
38 checks passed
@henryiii henryiii deleted the henryiii/chore/ruff-PT branch November 12, 2025 03:34
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.

2 participants