I wonder if the current way loaddata works could be improved a bit. The
idea is to make fixture labels more explicit. The possible changes would
be:
- write the filename in full, that is the filename must include the
format (.xml for example) and if the file is compressed, then also
compression (.bz2 for example). so, one must write admin-views-
users.xml.bz2 instead of just admin-views-users.
- no duplicates allowed (except for initial_data). So, if there are
multiple admin-views-users fixtures, then one must explicitly write from
which app the fixture is: "admin_views/admin-views-users.xml".
There could also be some explicit "allow duplicates" markers:
"*/initial_data.*" for all initial_data files in any app (the first *), in
any format or compression (the latter *).
These changes aren't necessary to fix the immediate issues in Django's
test suite. App dependencies patch (#20483) will solve these issues, or
just plain renaming of the problematic fixture files will suffice.
--
Ticket URL: <https://code.djangoproject.com/ticket/20551>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Given the changes in fixture loading I committed yesterday, app-dependency
won't suffice... We need a way to clear the `fixture_dirs` cached property
in loaddata.
Surprisingly, the previous code allows for duplicates in different apps
but not in the same app. It could be an accident. I preserved that
behavior but I don't understand it.
--
Ticket URL: <https://code.djangoproject.com/ticket/20551#comment:1>
* stage: Unreviewed => Accepted
Comment:
I think just renaming the duplicate fixtures is enough for now. Do these
still get double-loaded? Even if not having admin-views-users fixture in
admin_inlines tests is pointless.
--
Ticket URL: <https://code.djangoproject.com/ticket/20551#comment:2>