Code

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#21551 closed Bug (fixed)

1.6 regression: Can't load fixtures from subdir

Reported by: jonash 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.

Attachments (0)

Change History (5)

comment:1 Changed 5 months ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker

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

comment:2 Changed 5 months ago by timo

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 months ago by claudep

  • Has patch set

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

comment:4 Changed 5 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 5 months ago by Claude Paroz <claude@…>

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.