Tests does not report missing fixtures
|Reported by:||vzima||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If a test contains fixtures, which do not exists, it does not report it as as failure. This is serious problem as fixtures are part of the test and their absence may cause false-positive success.
Consider this example:
from django.test import TestCase class TestFoo(TestCase): fixtures = ('/invalid/filename', ) # Assume the fixture should load FooModel(pk=1) def test_foo_delete(self): delete_if_foo_exists(pk=1) self.assertFalse(FooModel.objects.filter(pk=1).exists())
Such a test would pass even if the delete_if_foo_exists does nothing.
This test is a very simple example, but ignoring the fact that fixtures are not loaded, can easily hide less obvious and more severe errors. Mere typo in fixture name can very well lead to a serious error.
Change History (5)
comment:1 Changed 2 years ago by jacobh
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Resolution set to duplicate
- Status changed from new to closed
comment:3 Changed 2 years ago by kmtracey
- Resolution duplicate deleted
- Status changed from closed to new