#14049: Fixture loading should be skipped for TestCase decorated with @skip*
-------------------------------+--------------------------------------------
Reporter: zimnyx | Owner: nobody
Status: new | Milestone:
Component: Testing framework | Version: 1.2
Keywords: | Stage: Unreviewed
Has_patch: 0 |
-------------------------------+--------------------------------------------
!TransactionTestCase overrides unittest.!TestCase.!__call!__() and always
runs _fixture_setup(), even for skipped tests (decorated with @skip* from
unittest).
It makes no sense at all and it's really waste of time to wait for those
fixtures to load.
{{{
class TransactionTestCase(unittest.TestCase):
def _pre_setup(self):
"""Performs any pre-test setup. This includes:
* Flushing the database.
* If the Test Case class has a 'fixtures' member, installing
the
named fixtures.
* If the Test Case class has a 'urls' member, replace the
ROOT_URLCONF with it.
* Clearing the mail test outbox.
"""
self._fixture_setup()
self._urlconf_setup()
mail.outbox = []
# ...
def __call__(self, result=None):
"""
Wrapper around default __call__ method to perform common Django
test
set up. This means that user-defined Test Cases aren't required to
include a call to super().setUp().
"""
self.client = Client()
try:
self._pre_setup() # LOAD FOR EVERY TestCase
except (KeyboardInterrupt, SystemExit):
raise
except Exception:
import sys
result.addError(self, sys.exc_info())
return
super(TransactionTestCase, self).__call__(result) # HERE @skip*
decorators are honoured
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/14049>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.