Tuesday, April 26, 2016

Test runner wants to run models package?!

Hallöchen!

With Django 1.9.5 (rest are original Ubuntu 16.04 packages) and
Python 3.5.1, "manage.py test myapp" tries to run the *models*
package of myapp as a test module:

user@localhost:~/src/myproject/myproject$ ./manage.py test myapp --pattern=invalid_pattern
Creating test database for alias 'default'...
Destroying old test database for alias 'default'...
E
======================================================================
ERROR: myproject.myapp.models (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: myproject.myapp.models
Traceback (most recent call last):
File "/usr/lib/python3.5/unittest/loader.py", line 462, in _find_test_path
package = self._get_module_from_name(name)
File "/usr/lib/python3.5/unittest/loader.py", line 369, in _get_module_from_name
__import__(name)
File "/home/user/src/myproject/myproject/myapp/models/__init__.py", line 26, in <module>
from .physical_processes import *
File "/home/user/src/myproject/myproject/myapp/models/physical_processes.py", line 66, in <module>
class Substrate(PhysicalProcess):
File "/usr/local/lib/python3.5/dist-packages/django/db/models/base.py", line 102, in __new__
"INSTALLED_APPS." % (module, name)
RuntimeError: Model class myproject.myapp.models.physical_processes.Substrate doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.


----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
Destroying test database for alias 'default'...



I chose "invalid_pattern" to limit it to the models package.
Without "--pattern", all *real* tests are run, too. Using Python2,
everything is fine. Does anybody have an idea what's going on here?

Tschö,
Torsten.

--
Torsten Bronger Jabber ID: torsten.bronger@jabber.rwth-aachen.de

--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/87wpnkkoxl.fsf%40physik.rwth-aachen.de.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment