#25868 closed Bug (invalid)
Importing django.test.utils.get_runner fails on Django 1.9 with Python 3.3
| Reported by: | Lewis Sobotkiewicz | Owned by: | nobody |
|---|---|---|---|
| Component: | Testing framework | Version: | 1.9 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The following code:
from django.test.utils import get_runner
Errors out with the following traceback in Django 1.9 with Python 3.3:
Traceback (most recent call last):
File "runtests.py", line 116, in <module>
runtests(failfast=options.failfast, verbosity=options.verbosity, coverage=options.coverage, *args)
File "runtests.py", line 92, in runtests
from django.test.utils import get_runner
File "/usr/local/lib/python3.3/site-packages/django/test/__init__.py", line 5, in <module>
from django.test.client import Client, RequestFactory
File "/usr/local/lib/python3.3/site-packages/django/test/client.py", line 12, in <module>
from django.apps import apps
File "/usr/local/lib/python3.3/site-packages/django/apps/__init__.py", line 1, in <module>
from .config import AppConfig
File "/usr/local/lib/python3.3/site-packages/django/apps/config.py", line 6, in <module>
from django.utils.module_loading import module_has_submodule
File "/usr/local/lib/python3.3/site-packages/django/utils/module_loading.py", line 67, in <module>
from importlib.util import find_spec as importlib_find
ImportError: cannot import name find_spec
Apparently importlib.util.find_spec appeared in Python 3.4 and thus fails to import in Python 3.2 and 3.3: https://docs.python.org/3/library/importlib.html#importlib.util.find_spec
Note:
See TracTickets
for help on using tickets.
From the 1.9 release notes: