-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
pytest --pdb breaks Django test cases #1977
Comments
Thanks for the report! Sorry to hear this change brought you problems! 😞 I'm starting to think we probably should add a flag that is opted in to avoid this type of regression... apparently it is common for frameworks to override the @mbyt what do you think? Perhaps a |
The other option is that it gets fixed upstream in Django, and then a piece of magic is added to |
My conclusion is still the same as for #1932: If people overwrite unittest.TestCase However for this case What is unfortunate is that quite some people seem to overwriting |
I agree. I regret we didn't release this in |
I need to say this: I knew why I mentioned (after the merge though...) that it should go to |
@The-Compiler if only. 😢 |
I'll report this to Django and try find a fix to add to |
@adamchainz thanks a lot! Please keep this thread updated. 😁 I'm closing this for now, but we should re-open if we decide to take another route in the future. |
@adamchainz |
Since #1890, when running with
--pdb
, Django test cases don't get per-test transactions. This is similar to #1932; Django has an equivalent_pre_setup
function that needs calling per test to set up transactions (source - later in file for transaction support underTestCase
). Since the--pdb
change, the test case isn't called, so_pre_setup
isn't called, so tests don't get transactional isolation.A developer who always ran tests with
--pdb
noticed this first after our upgrade to 3.0.2. It took a long time to find that it was just the--pdb
flag stopping database rollback, and not some weird behaviour in our app causing the inter-test failures 😢The text was updated successfully, but these errors were encountered: