-
-
Notifications
You must be signed in to change notification settings - Fork 694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add --pytest
argument to name-tests-test hook.
#712
Comments
the default mode is pytest mode -- allowing both is not desirable (pick one and stick with it for consistency) |
Looking at this line of code:
File names like
unless I allow them with the So, if we were picky then the above line should change to test_name_pattern = r'test.*\.py' if args.django else r'test_.*\.py|.*_test\.py' which is actually correct considering PyTest’s documented file name patterns. Furthermore, I’d consider changing pre-commit-hooks/.pre-commit-hooks.yaml Line 165 in 8559bc5
because it’s incorrect when using the |
yes of course I understand that, I am a pytest core maintainer the tool chooses instead to enforce a convention rather than letting you loosely use multiple naming ideas -- but it gives you the freedom to choose which convention you prefer if you don't want to pick a convention them simply don't use the tool note also that the tool's existence predates pytest's change in convention (allowing both names) while we're being pedantic, note also that pytest is not spelled "PyTest" but is stylized "pytest" |
Thank you for the context!
Alrighty, time to update the tool/hook then 😉 Alternatively, how about adding a
Would you like a PR for that change? |
I'm sorry but you're not listening, I'm not going to continue this discussion |
Considering that
pytest
’s test discovery uses “test_*.py
or*_test.py
” file names, I think it makes sense to make this hook a bit more flexible — e.g. by adding a dedicated arg.Happy to provide PR.
The text was updated successfully, but these errors were encountered: