[Django] #24618: Incorrect duplicate app message shown when no duplicates found

49 views
Skip to first unread message

Django

unread,
Apr 10, 2015, 5:17:39 AM4/10/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------
Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------
https://github.com/django/django/pull/4476

Details of this bug are in the ticket but over view is

I have an app with construct

```
project_name.apps.core
```

Consistently got: when running tests

```
django.core.exceptions.ImproperlyConfigured: Application labels aren't
unique, duplicates: core
```

Despite absolutely no chance of it being duplicate;

print of apps form within registry.py

```
('project_name.apps.v2_api', 'project_name.apps.v1_api',
'project_name.apps.applications', 'project_name.apps.backend',
'project_name.apps.core', 'project_name.apps.tools',
'project_name.apps.me', 'project_name.apps.brand',
'project_name.apps.workorder', 'project_name.apps.batch',
'project_name.apps.printer', 'project_name.apps.scan',
'project_name.apps.code', 'project_name.apps.dash',
'project_name.apps.role_permission')
```

Considered it being a conflict with django.core (but seems not to be the
case)

Am using a custom test runner

```
class AppTestRunner(DiscoverRunner):
def build_suite(self, test_labels, *args, **kwargs):
# not args passed in
if not test_labels:
test_labels = settings.PROJECT_APPS

return super(AppTestRunner, self).build_suite(test_labels, *args,
**kwargs)
```

As you can see the runner runs test tests from ONLY the project and not
the dango/helper app test cases

I noticed there has been a very recent refactor (march) of the registry;
which is what prompted the investigation as I have had a 1.7 merge branch
for this project for some time and the tests have always run with no
issue. I recently re installed django (1, 7, 5, 'final', 0) and this error
started happening.

I hope the fix makes sense.

--
Ticket URL: <https://code.djangoproject.com/ticket/24618>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 10, 2015, 7:15:49 AM4/10/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Old description:

New description:

https://github.com/django/django/pull/4476

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:1>

Django

unread,
Apr 10, 2015, 1:04:30 PM4/10/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

Can you upload a sample project or tell us how we can reproduce this? It
seems like you might have an issue in your project as I don't understand
why the proposed change needs to be made in Django.

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:2>

Django

unread,
Apr 11, 2015, 9:49:59 AM4/11/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by rosscdh):

Hi Tim,

I have described and documented the issue in both the ticket and the PR.

I also thought it to be a bug within my project but after extensive
investigation its actually not.

In a custom testRunner (extending the default django runner in runner.py)
if I inject a tuple of JUST my projects apps the duplicate error arises.

Please review the PR at: https://github.com/django/django/pull/4476

Regards
Ross

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:3>

Django

unread,
Apr 11, 2015, 10:04:14 AM4/11/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

I tried to reproduce it with the project structure you described, but
wasn't having any luck. Is it only an issue with the custom test runner? I
didn't try adding that.

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:4>

Django

unread,
Apr 13, 2015, 3:43:55 AM4/13/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by rosscdh):

Hi there app setup and test runner below.


```
DJANGO_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
)

PROJECT_APPS = (
'my_project.apps.v2_api',
'my_project.apps.v1_api',
'my_project.apps.applications',
'my_project.apps.backend',
'my_project.apps.core',
'my_project.apps.tools',
'my_project.apps.me',
'my_project.apps.brand',
'my_project.apps.workorder',
'my_project.apps.batch',
'my_project.apps.printer',
'my_project.apps.scan',
'my_project.apps.code',
'my_project.apps.dash',
'my_project.apps.role_permission',
)

HELPER_APPS = (
'pipeline',
'registration',
'password_reset',
'django_extensions',
'raven.contrib.django.raven_compat',

'parsley',
'corsheaders',
'crispy_forms',
'rest_framework',
)

INSTALLED_APPS = DJANGO_APPS + PROJECT_APPS + HELPER_APPS
```

```
from django.test.runner import DiscoverRunner


class AppTestRunner(DiscoverRunner):
def build_suite(self, test_labels, *args, **kwargs):
# not args passed in
if not test_labels:
test_labels = settings.PROJECT_APPS

return super(AppTestRunner, self).build_suite(test_labels, *args,
**kwargs)
```

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:5>

Django

unread,
Apr 13, 2015, 12:40:46 PM4/13/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by timgraham):

Unfortunately, I still can't reproduce it with those details. Could you
try putting together a minimal project that reproduces the error that we
could download? A regression test for Django's test suite to complement
your patch might be fine too.

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:6>

Django

unread,
Apr 16, 2015, 6:59:50 AM4/16/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by rosscdh):

Ill try allocate some time for it! :) thanks

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:7>

Django

unread,
Apr 16, 2015, 7:07:03 AM4/16/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------

Reporter: rosscdh | Owner: nobody
Type: Bug | Status: new
Component: Testing framework | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------

Comment (by rosscdh):

Ok, so this is very strange. I've re-installed django 1.7 (not change to
version tho) aaaand its working.

have been running clean_pyc as well as custom make clean command that
looks for pyc files.

..

I guess the bug is invalid.. I apologise for wasting time. And thank you
for your efforts to reproduce.

--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:8>

Django

unread,
Apr 16, 2015, 7:20:25 AM4/16/15
to django-...@googlegroups.com
#24618: Incorrect duplicate app message shown when no duplicates found
-----------------------------------+--------------------------------------
Reporter: rosscdh | Owner: nobody
Type: Bug | Status: closed

Component: Testing framework | Version: 1.7
Severity: Normal | Resolution: invalid
Keywords: | Triage Stage: Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by timgraham):

* status: new => closed
* resolution: => invalid


--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:9>

Reply all
Reply to author
Forward
0 new messages