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.
* 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>
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>
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>
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>
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>
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>
Comment (by rosscdh):
Ill try allocate some time for it! :) thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:7>
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>
* status: new => closed
* resolution: => invalid
--
Ticket URL: <https://code.djangoproject.com/ticket/24618#comment:9>