Re: Test runner wants to run models package?!
Hallöchen! Tim Graham writes: > Could you try Python 3.4.x? The problem does not exist with Python 3.4.3. (Ubuntu 14.04) > I ran into some issues with Django's own test suite [0] due to > some import changes in Python 3.5 [1]. If I look at Python 3.5's release notes, the following is suspicious: Found packages are now checked for load_tests regardless of whether their path matches pattern, because it is impossible for a package name to match the default pattern. I understand this this way: The pattern still works for .py files but not for packages (__init__.py files). And since my models' __init__.py says from .physical_processes import * and the app is not yet set up, this breaks. Question is: Is is bad style to have a models *package* which collects alls models in its __init__.py, or has Django to be adapted to Python's new behaviour? Tschö, Torsten. -- Torsten BrongerJabber ID: torsten.bron...@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+unsubscr...@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/87potbc87j.fsf%40physik.rwth-aachen.de. For more options, visit https://groups.google.com/d/optout.
Re: Test runner wants to run models package?!
Could you try Python 3.4.x? I ran into some issues with Django's own test suite [0] due to some import changes in Python 3.5 [1]. [0] https://code.djangoproject.com/ticket/23763#comment:11 [1] http://bugs.python.org/issue7559 On Tuesday, April 26, 2016 at 6:04:56 PM UTC-4, Torsten Bronger wrote: > > 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 > from .physical_processes import * > File > "/home/user/src/myproject/myproject/myapp/models/physical_processes.py", > line 66, in > 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 BrongerJabber ID: torsten...@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+unsubscr...@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/a7b14bea-022c-4f9d-984d-2c63fdf60b8c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
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 from .physical_processes import * File "/home/user/src/myproject/myproject/myapp/models/physical_processes.py", line 66, in 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 BrongerJabber ID: torsten.bron...@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+unsubscr...@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.