#12574 closed (fixed)
all tests pass when there broken tests becase they are skipped
Reported by: | CarlFK | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If a test is broken (like typo in models.py)
and you run the full set of tests:
django-trunk/tests$ ./runtests.py --settings=sets_sqlite3
the broken test gets skipped
and so you get:
---------------------------------------------------------------------- Ran 1390 tests in 243.340s OK ----------------------------------------------------------------------
Which makes you think "oh boy! all my tests passed!" and go dancing in the street.
But no! the very test you were most concerned about never got run.
If you dig around in the output, you will see the error.
If you see OK, you really have no reason to do that.
Here is why:
(trimmed down version)
try: mod = load_app(model_label) if mod: settings.INSTALLED_APPS.append(model_label) except Exception, e: sys.stderr.write("Error while importing %s:" % model_name + ''.join(traceback.format_exception(*sys.exc_info())[1:]))
Looking at the change history, it seems this is the result of some refactoring that resulted in this hiding place for bad tests. The "continue" command is unnecessary, given it is at the end of the codeblock.
Seems the fix is to remove the try/except:err.write and let the error get thrown.
btw, the comment for
if not test_labels or model_name in set([label.split('.')[0] for label in test_labels]):
is screwy. so is the code. Neither read well. if you fully understand it, it would be great if it could be cleaned up so I don't get a headache.
Attachments (2)
Change History (6)
by , 15 years ago
Attachment: | runtests.diff added |
---|
comment:1 by , 15 years ago
by , 15 years ago
Attachment: | 12574.diff added |
---|
Same patch plus moving calculation of the set of test outside of a loop
comment:2 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
to see the bug in action:
If you do -v 0 (the default), then you will see the stack dump ending in
but also see: OK (which means 'all tests passed') (which is the bug).