-
Notifications
You must be signed in to change notification settings - Fork 343
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
Run checks at the start of tests #414
base: main
Are you sure you want to change the base?
Run checks at the start of tests #414
Conversation
A few things need discussing/doing:
The output is required to see the failing checks. At YPlan our implementation has similar code to this PR in a fixture like:
|
Very interesting feature! I often forget to run the Django checks myself... pytest-django is designed to be usable where not the full test suite depends on Django, and being able to run a subset of tests and construct Django dependencies (DB) when needed. autouse=True for db would not really be feasible without breaking that and I think we should try to find another way around to make this usable. :) We could look at pytest-pep8 or pytest-flakes for inspiration. We could use a command line option like |
a9a81b5
to
c97a9a5
Compare
Updated now I've updated my Django PR. I still haven't added a config option to disable it or a changelog note, but it's working the same way Django 1.11 will. |
@adamchainz |
c97a9a5
to
a5bc562
Compare
No, rebased on latest master and pushed because Travis had lost the logs. Will look at this agian, thanks for nudge |
Hi @adamchainz would be great to have this in! |
a5bc562
to
7aa1ea0
Compare
I have (finally) had another look at this in the Djangocon EU 2018 sprints. Here's the status:
I think I might need some help from the pytest team |
It should likely use some more specific pytest hook, e.g. In general I think that running this separately in CI is better than with (possibly) every pytest invocation. |
Checks take milliseconds and can save a lot of painful debugging because they have clearer errors around misconfiguration. If they aren't run in tests, they can be missed in TDD workflows, since most users would only see them on runserver and might work on a change without actually running the server. I found this repeatedly in my job at the time and that's why I pushed to make it officially done nat start of tests in Django 1.11 (IIRC it was done accidentally in Django up until 1.9 but then a refactor dropped it in 1.10). |
Ok. I'm ok with adding it, but there should be an option for it, defaulting to off in my opinion - but I would be happy enough if I could disable it. Like you said already it probably needs to integrate differently with pytest. |
I still find it a very useful feature, defaulting to on in my opinion. @adamchainz have you tried to make it a discoverable test? It could just run always as the first of the tests and add to the failures and/or stop when used with |
I think |
Fixes #337. Checks are run at the start of tests, like Django does in 1.11+ after django/django#6294 was merged.