Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

codecoverage causes re-registration of admin models #2

Open
schinckel opened this issue Jan 15, 2010 · 2 comments
Open

codecoverage causes re-registration of admin models #2

schinckel opened this issue Jan 15, 2010 · 2 comments

Comments

@schinckel
Copy link
Contributor

No description provided.

@schinckel
Copy link
Contributor Author

When I have a model that has an admin interface registered, and I run test with —coverage, then I get an AlreadyRegistered exception:

Traceback (most recent call last):
File "./manage.py", line 11, in
execute_manager(settings)
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/init.py", line 362, in execute_manager
utility.execute()
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/init.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/base.py", line 195, in run_from_argv
self.execute(_args, *_options.dict)
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/core/management/base.py", line 222, in execute
output = self.handle(_args, *_options)
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/test_extensions/management/commands/test.py", line 66, in handle
interactive=interactive)
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/test_extensions/testrunners/codecoverage.py", line 74, in run_tests
coverage_modules.extend(get_all_coverage_modules(app))
File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/test_extensions/testrunners/codecoverage.py", line 43, in get_all_coverage_modules
{}, {}, mod_name)
File "/Users/REDACTED/REDACTED/Development/REDACTED/apps/country/admin/init.py", line 4, in

File "/usr/local/Cellar/EasyInstall/2.6/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg/django/contrib/admin/sites.py", line 78, in register
raise AlreadyRegistered('The model %s is already registered' % model.name)
django.contrib.admin.sites.AlreadyRegistered: The model Country is already registered

@schinckel
Copy link
Contributor Author

My workaround was to ignore all exceptions when importing for coverage checking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant