-
Notifications
You must be signed in to change notification settings - Fork 346
Add a failing unittest case when using --pdb
option
#406
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
Can you merge/cherry-pick #400 into this, so it fails here, too, please? |
Added a quick workaround in latest commit d5696a2 ; this is basically copy-pasta of |
self._post_teardown() | ||
|
||
cls.debug = _cleaning_debug | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a comment/doc!
It was mentioned to report it for Django itself also.. has that been done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment added in 74bef8d. I'm not sure this deserves mention in docs (besides maybe in the changelog). I'll submit a bug report with Django when I get a chance.
d5696a2
to
74bef8d
Compare
Django ticketed opened, for back ref: https://code.djangoproject.com/ticket/27391 |
@blueyed I didn't get around to opening the Django ticket as I said I would in pytest-dev/pytest#1977 ... thanks @asfaltboy ! |
74bef8d
to
50d17c6
Compare
- The workaround is taken from the comments in pytest-dev/pytest#1932 - It does not wrap the _pre_setup/_post_teardown calls in try/except clauses to allow exception to be raised for debugging purposes
50d17c6
to
284af35
Compare
Thanks for all debugging! I've merged this and will soon put out a 3.1.1 release which contains this fix! |
This commit works around the root cause in Django: https://code.djangoproject.com/ticket/27391
This commit works around the root cause in Django: https://code.djangoproject.com/ticket/27391
Here's a failing test for #405, tests on travis-ci and tox pass. This helped to isolate it to occurring on latest
pytest==3.0.3
, probably has something to do with thepdb
changes in the last minor releases. Specifically, changelog for 3.0.2 includes merge of PR pytest-dev/pytest#1890:In essence, it's not a bad change; but, when combined with
--reuse-db
or whensetUp
create unique Django objects this fails hard.I guess one way, would be to re-enable this cleanup for
pytest-django
only.But, to be honest, not sure how many more devs may spend hours looking for their missing tearDown code. On the other hand, I myself have suffered from "early cleanUp when using pdb". Hmmm, maybe there is a better way.
Other users have noted this can cause issues at pytest-dev/pytest#1932