Opened 17 years ago

Closed 17 years ago

#6436 closed (fixed)

loaddata can load fixture data multiple times, if specified with absolute pathname

Reported by: btoll <btoll@…> Owned by: nobody
Component: Core (Other) Version: dev
Severity: Keywords: loaddata absolute pathname
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Attached patch includes a regression test that demonstrates issue, along with a proposed fix (for review).

The situation can arise if a project has a test fixture that is maintained outside of the project structure. An attempt to load the fixture with an absolute path, e.g.

python manage.py loaddata /path/to/fixture

will work, but consumes more time and memory than necessary, since the fixture data will be loaded once for every fixture directory in a project (in either an installed application or FIXTURE_DIRS).

This effect can be observed in the count of objects and fixtures that are reported by the loaddata command. Setting '--verbosity=2' makes it more apparent.

Attachments (1)

loaddata_absolute_20080121a.diff (2.6 KB ) - added by btoll <btoll@…> 17 years ago.
Regression test and proposed fix

Download all attachments as: .zip

Change History (3)

by btoll <btoll@…>, 17 years ago

Regression test and proposed fix

comment:2 by Russell Keith-Magee, 17 years ago

Resolution: fixed
Status: newclosed

(In [7145]) Fixed #6436 -- Added check for absolute paths in fixture loading. Fixtures specified as an absolute path were being loaded multiple times. Thanks to btoll@… for the report, fix, and catch of a duplicate ticket.

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