Skip to content

Django 1.10 error: No fixture named 'django_admin_smoke_tests' found #9

Description

@jcushman

Django 1.10 appears to throw an error if a fixture cannot be found, which breaks the default setup described in the README. This isn't fixed by the #8 pull request.

Following the install instructions from README results in this error:

Traceback (most recent call last):
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/test/testcases.py", line 209, in __call__
    self._pre_setup()
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/test/testcases.py", line 839, in _pre_setup
    self._fixture_setup()
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/test/testcases.py", line 895, in _fixture_setup
    **{'verbosity': 0, 'database': db_name})
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 130, in call_command
    return command.execute(*args, **defaults)
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 64, in handle
    self.loaddata(fixture_labels)
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 97, in loaddata
    if self.find_fixtures(fixture_label):
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/utils/lru_cache.py", line 100, in wrapper
    result = user_function(*args, **kwds)
  File "/home/vagrant/.virtualenvs/perma/local/lib/python2.7/site-packages/django/core/management/commands/loaddata.py", line 253, in find_fixtures
    raise CommandError("No fixture named '%s' found." % fixture_name)
CommandError: No fixture named 'django_admin_smoke_tests' found.

The workaround is either for the user to provide a django_admin_smoke_tests fixture (which isn't documented), or to override fixtures in the test class.

It looks like the tests are passing in the sample project because they all set fixtures = [], which doesn't seem ideal. Probably would be better to override _fixture_setup to only include the fixture if it exists, although I haven't worked out how to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions