-
Notifications
You must be signed in to change notification settings - Fork 344
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
TestCase.skipTest()
skips _post_teardown
#772
Comments
Thanks for the report. Can you provide a failing test, similar to https://github.com/blueyed/pytest-django/blob/c023564e708b5c55b57df43776d21643d1f1f2ce/tests/test_unittest.py#L461-L489 I guess? |
So it's only a problem when using pytest-django/pytest_django/fixtures.py Lines 152 to 153 in c023564
But is skipped explicitly in pytest-django/pytest_django/plugin.py Lines 538 to 540 in c023564
|
Django does the same: https://github.com/django/django/pull/7436/files#diff-5d7d8ead1a907fe91ffc121f830f2a49R272-R279
Interesting. Likely because the test is not being invoked in the first place though. |
This might be a bigger issue with |
pytest-dev/pytest#5996 should fix the issue in pytest. But pytest-django would still not call pytest-django/pytest_django/plugin.py Lines 534 to 538 in 382c6bb
However, with pytest not calling AFAICS |
Not calling |
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
I believe #782 fixes it. |
Releasing as v3.7.0 already.. |
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
Fixes pytest-dev#5991 Fixes pytest-dev#3823 Ref: pytest-dev/pytest-django#772 Ref: pytest-dev#1890 Ref: pytest-dev/pytest-django#782 - inject wrapped testMethod - adjust test_trial_error - add test for `--trace` with unittests
TestCase.skipTest()
will raise aSkipTest
exception, which is not caught in_cleaning_debug
, so the_post_teardown()
call is skipped. Also apparently cleanups registered withTestCase.addCleanup()
will not be run. If setup done in_pre_setup
needs to be undone in_post_teardown
(or in cleanups scheduled withaddCleanup()
), that will not happen for tests skipped withskipTest()
.This does not apply to tests skipped with a
@unittest.skip
decorator.For comparison,
nose
runs_post_teardown
methods for tests skipped withskipTest()
.The text was updated successfully, but these errors were encountered: