Friday, July 31, 2020

"pytest --doctests-modules" AlreadyRegistered error

I am using doctests via pytest with the command "pytest --doctest-modules".  Unfortunately, I keep getting the following error.  I've already attached a screenshot.  Does anyone understand what's causing and how to address it?  Thanks!


============================================== ERRORS ===============================================
__________________________________ ERROR collecting main/admin.py ___________________________________
main\admin.py:25: in <module>
    admin.site.register(PoolType, PoolTypeAdmin)
..\..\..\.virtualenvs\mysite\lib\site-packages\django\contrib\admin\sites.py:109: in register
    raise AlreadyRegistered('The model %s is already registered' % model.__name__)
E   django.contrib.admin.sites.AlreadyRegistered: The model PoolType is already registered
__________________________________ ERROR collecting main/models.py __________________________________
main\models.py:36: in <module>
    class PoolType(models.Model):
..\..\..\.virtualenvs\mysite\lib\site-packages\django\db\models\base.py:111: in __new__
    "INSTALLED_APPS." % (module, name)
E   RuntimeError: Model class mysite.main.models.PoolType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
====================================== short test summary info ======================================
ERROR main/admin.py - django.contrib.admin.sites.AlreadyRegistered: The model PoolType is already r...
ERROR main/models.py - RuntimeError: Model class mysite.main.models.PoolType doesn't declare an ...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================= 2 errors in 0.62s =========================================

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3acb7334-e158-4c83-af7c-35a55a2d9afan%40googlegroups.com.

No comments:

Post a Comment