﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21089	TestCase can't define an empty list of fixtures	Lorenzo Gil Sanchez	nobody	"This could be useful if you have a TestCase base class that define some very basic fixtures that are used across all your tests but then, there is a few particular tests that do not want such fixtures.

Let's say you have something like:

{{{
class BaseTestCase(TestCase):

  fixtures = ['basic_data.json']


class NoFixturesTestCase(BaseTestCase):

  fixtures = []
}}}

If you do this you will get this error:

{{{
Traceback (most recent call last):
  File ""/home/lgs/proyectos/personal/django/django/test/testcases.py"", line 173, in __call__
    self._pre_setup()
  File ""/home/lgs/proyectos/personal/django/django/test/testcases.py"", line 716, in _pre_setup
    self._fixture_setup()
  File ""/home/lgs/proyectos/personal/django/django/test/testcases.py"", line 848, in _fixture_setup
    'skip_validation': True,
  File ""/home/lgs/proyectos/personal/django/django/core/management/__init__.py"", line 159, in call_command
    return klass.execute(*args, **defaults)
  File ""/home/lgs/proyectos/personal/django/django/core/management/base.py"", line 289, in execute
    output = self.handle(*args, **options)
  File ""/home/lgs/proyectos/personal/django/django/core/management/commands/loaddata.py"", line 49, in handle
    ""No database fixture specified. Please provide the path ""
CommandError: No database fixture specified. Please provide the path of at least one fixture in the command line.
}}}

You can use this hack as a workaround:


{{{
class NoFixturesTestCase(BaseTestCase):

  fixtures = ['non-existing-file.json']
}}}

And now you will get a warning instead of an error.

I'll create a Github branch with a test showing this behaviour and a fix for it."	Bug	closed	Testing framework	1.5	Normal	fixed	fixtures		Accepted	1	0	0	1	0	0
