Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#21551 closed Bug (fixed)

1.6 regression: Can't load fixtures from subdir

Reported by: Jonas H. Owned by: nobody
Component: Core (Management commands) Version: 1.6
Severity: Release blocker Keywords: loaddata, fixtures
Cc: jonas-django@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Consider this fixture directory (added to FIXTURE_DIRS):

- fixtures/
  + initial_data.json
  + tests/
    - initial_data_inner.json

Loading the outer fixture works:

$ ./manage.py loaddata initial_data
Installed 3 object(s) from 1 fixture(s)

The inner does not:

$ ./manage.py loaddata initial_data_inner
…site-packages/django/core/management/commands/loaddata.py:218: UserWarning: No fixture named 'initial_data_inner' found.
  warnings.warn("No fixture named '%s' found." % fixture_name)

Installed 0 object(s) from 0 fixture(s)

$ ./manage.py loaddata tests/initial_data_inner
…site-packages/django/core/management/commands/loaddata.py:218: UserWarning: No fixture named 'initial_data_inner' found.
  warnings.warn("No fixture named '%s' found." % fixture_name)

Installed 0 object(s) from 0 fixture(s)

This used to work in Django 1.5.

The cause of this is that all fixture names that contain an os.path.sep are considered absolute paths in the loaddata management command.

Change History (5)

comment:1 by Aymeric Augustin, 10 years ago

Severity: NormalRelease blocker

Marking as a release blocker since it's a regression.

comment:2 by Tim Graham, 10 years ago

Triage Stage: UnreviewedAccepted

comment:3 by Claude Paroz, 10 years ago

Has patch: set

https://github.com/django/django/pull/2036
This issue is partially related to #20933.

comment:4 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 41ebc4838d2b09e7f3ece8889e21492902b55dc8:

Fixed #21551 -- Reenabled loading fixtures from subdirectory

This was a regression in Django 1.6 that was only partially
restored in 839940f27f.
Thanks Jonas Haag for the report.

comment:5 by Claude Paroz <claude@…>, 10 years ago

In 45c0d2e1ce0fe024e4a80c9dde8263f5ff59d577:

[1.6.x] Fixed #21551 -- Reenabled loading fixtures from subdirectory

This was a regression in Django 1.6 that was only partially
restored in 839940f27f.
Thanks Jonas Haag for the report.
Backport of 41ebc4838d from master.

Note: See TracTickets for help on using tickets.
Back to Top