Code

Opened 6 years ago

Closed 6 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: master
Severity: Keywords: loaddata absolute pathname
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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@…> 6 years ago.
Regression test and proposed fix

Download all attachments as: .zip

Change History (3)

Changed 6 years ago by btoll <btoll@…>

Regression test and proposed fix

comment:1 Changed 6 years ago by btoll

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by russellm

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

(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.

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.