#15689: test --failfast doesn't stop on errors in _pre_setup()
---------------------------------------------+----------------------
Reporter: slinkp@… | Owner: nobody
Status: reopened | Milestone:
Component: Testing framework | Version: 1.2
Resolution: | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 |
---------------------------------------------+----------------------
Changes (by slinkp):
* status: closed => reopened
* resolution: worksforme =>
Comment:
Sorry, I mis-reported. I've updated the title, though Trac won't let me
edit the description (maybe I wasn't signed in before).
The real problem was that if TestCase._pre_setup() raises an exception,
all tests are still run but reported as errors.
I did notice that exceptions raised by TestCase.setUp() *will* exit on the
first error with --failfast.
So far, _pre_setup() is the only place I've observed this problem with
failfast.
FWIW, the way that I discovered this was by having a multi-database
configuration that worked on 1.2.3 but apparently wasn't compatible with
the introduction of the TEST_DEPENDENCIES setting in 1.2.4.
Demonstration: Drop this in your app's tests.py and run tests:
{{{
class SimpleTest(TestCase):
def _pre_setup(self):
super(SimpleTest, self)._pre_setup()
raise Exception("oh nooo")
def test_aaa_ok(self):
pass
def test_bbb_ok(self):
pass
def test_ccc_nameerror(self):
return foo
def test_ddd_zerodivisionerror(self):
return 3 / 0
def test_eee_failing(self):
self.assertEqual(1, 2)
def test_zzz_ok(self):
pass
}}}
I see 6 errors reported, even with --failfast:
{{{
$ django-admin.py test --failfast testapp
... snip ...
Ran 0 tests in 0.001s
FAILED (errors=6)
Destroying test database 'default'...
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/15689#comment:3>
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.