-
Notifications
You must be signed in to change notification settings - Fork 346
Handle setUpClass also for unittest.TestCase #197
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
Conversation
Hmm, what is the purpose of this? What use cases are there for plain unittest testcases that expect the database to be there? Such tests is likely already broken since they have no proper rollback/flush in an ordinary with Django's test runner. If mixing non Django tests (which is unittest.TestCase subclasses) and having pytest-django enabled, this change may lead to unexpected things. |
I've came across such a testcase (https://github.com/yourlabs/django-autocomplete-light/blob/master/autocomplete_light/tests/views.py#L28), and thought it might have been just an oversight that regular unittests are not handled by this in pytest-django. I agree that the test could/should be fixed probably, e.g. by using a Django TestCase. However, for the process of migrating a test suite to pytest/pytest-django it seems to be good to behave like Django's testrunner would (even when that's broken).
Not sure about this. |
If you have a test suite with some Also, If you have a legacy test suite which interacts with the Django DB without inheriting from Regarding the error message about the marker, we could probably improve the failure when a database access happens from a |
👍 |
So, this PR is void, and I'll close it once we have an issue for the above. |
8492f3c
to
cd7c898
Compare
@pelme
Should this then also happen for access through |
cd7c898
to
fc67629
Compare
I've pushed the test case, and created a new issue about improving the failure case: #234 Closing this issue therefore. |
This is a follow-up to 8a9aacb.