[Django] #20551: Duplicate fixture labels

20 views
Skip to first unread message

Django

unread,
Jun 3, 2013, 1:47:44 AM6/3/13
to django-...@googlegroups.com
#20551: Duplicate fixture labels
--------------------------------------------+--------------------
Reporter: akaariai | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (Management commands) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------------+--------------------
There are a couple of instances where we load non-necessary fixture files:
1. There are a couple of initial_data fixtures (in fixtures[_regress]
tests IIRC). Any initial_data fixture is loaded for every
TransactionTestCase, so this causes a bit of repetitive non-necessary
work. If we add app-dependency to tests, then this isn't an issue any
more.
2. There are at least one duplicate fixture name. admin-views-users.xml
can be found from admin_views and admin_inlines. So, if admin_views loads
"admin-views-users.xml" fixture, it ends up loading both of the files.
Again app-dependency patch will solve this issue.

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.

Django

unread,
Jun 3, 2013, 2:49:55 AM6/3/13
to django-...@googlegroups.com
#20551: Duplicate fixture labels
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody
Type: | Status: new
Cleanup/optimization | Version: master
Component: Core (Management | Resolution:
commands) | Triage Stage:
Severity: Normal | Unreviewed
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* 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>

Django

unread,
Jun 16, 2013, 3:16:46 AM6/16/13
to django-...@googlegroups.com
#20551: Duplicate fixture labels
-------------------------------------+-------------------------------------
Reporter: akaariai | Owner: nobody

Type: | Status: new
Cleanup/optimization | Version: master
Component: Core (Management | Resolution:
commands) | Triage Stage: Accepted
Severity: Normal | Needs documentation: 0
Keywords: | Patch needs improvement: 0
Has patch: 0 | UI/UX: 0
Needs tests: 0 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by akaariai):

* 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>

Django

unread,
Mar 18, 2024, 3:25:09 AM3/18/24
to django-...@googlegroups.com
#20551: Duplicate fixture labels
-------------------------------------+-------------------------------------
Reporter: Anssi Kääriäinen | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ülgen Sarıkavak):

* cc: Ülgen Sarıkavak (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/20551#comment:3>
Reply all
Reply to author
Forward
0 new messages