#29127: Running tagged tests hides any with syntax errors
-------------------------------------+-------------------------------------
Reporter: Kryštof Řeháček | Owner: (none)
Type: Bug | Status: new
Component: Testing framework | Version: 2.0
Severity: Normal | Resolution:
Keywords: tests, tagged- | Triage Stage: Accepted
tests, SyntaxError |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Daniel Hones):
* status: assigned => new
* owner: Daniel Hones => (none)
Comment:
It looks like this behavior is ultimately due to Python's unittest
TestLoader and not Django's test framework. In case of a SyntaxError when
loading a test suite, it hits
[https://github.com/python/cpython/blob/master/Lib/unittest/loader.py#L439
this line], which creates a _FailedTest object from it without raising an
error. Then the {{{django.test.runner.filter_tests_by_tags()}}} sees a
_FailedTest object which won't have any tags and so it won't be run at
all. Since tests are tagged using a decorator, tests in a file with a
syntax error won't have any tags recognized for them anyway because the
file cannot be evaluated. I don't think there's a reasonable fix for this
and I'm not sure it should even be considered a bug, although the behavior
is a bit misleading.
--
Ticket URL: <https://code.djangoproject.com/ticket/29127#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.6b7721353116d5fc5d5e87bf4be15d35%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.