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

Django 4 support #1695

Open
jayvdb opened this issue Dec 25, 2021 · 5 comments
Open

Django 4 support #1695

jayvdb opened this issue Dec 25, 2021 · 5 comments

Comments

@jayvdb
Copy link
Contributor

jayvdb commented Dec 25, 2021

There is an error collecting tests

[   78s] _________ ERROR collecting tests/management/commands/test_show_urls.py _________
[   78s] ImportError while importing test module '/home/abuild/rpmbuild/BUILD/django-extensions-3.1.5/tests/management/commands/test_show_urls.py'.
[   78s] Hint: make sure your test modules/packages have valid Python names.
[   78s] Traceback:
[   78s] /usr/lib/python3.9/site-packages/_pytest/python.py:578: in _importtestmodule
[   78s]     mod = import_path(self.fspath, mode=importmode)
[   78s] /usr/lib/python3.9/site-packages/_pytest/pathlib.py:524: in import_path
[   78s]     importlib.import_module(module_name)
[   78s] /usr/lib64/python3.9/importlib/__init__.py:127: in import_module
[   78s]     return _bootstrap._gcd_import(name[level:], package, level)
[   78s] <frozen importlib._bootstrap>:1030: in _gcd_import
[   78s]     ???
[   78s] <frozen importlib._bootstrap>:1007: in _find_and_load
[   78s]     ???
[   78s] <frozen importlib._bootstrap>:986: in _find_and_load_unlocked
[   78s]     ???
[   78s] <frozen importlib._bootstrap>:680: in _load_unlocked
[   78s]     ???
[   78s] /usr/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
[   78s]     exec(co, module.__dict__)
[   78s] tests/management/commands/test_show_urls.py:4: in <module>
[   78s]     from django.conf.urls import url
[   78s] E   ImportError: cannot import name 'url' from 'django.conf.urls' (/usr/lib/python3.9/site-packages/django/conf/urls/__init__.py)
@jayvdb
Copy link
Contributor Author

jayvdb commented Dec 25, 2021

After that, lots of failures due to

[  125s]     from django.db.models.deletion import Collector
[  125s]     from django.utils import timezone
[  125s] >   from django.utils.encoding import force_str, smart_text
[  125s] E   ImportError: cannot import name 'smart_text' from 'django.utils.encoding' (/usr/lib/python3.9/site-packages/django/utils/encoding.py)
[  125s] 
[  125s] django_extensions/management/commands/dumpscript.py:44: ImportError

@jayvdb
Copy link
Contributor Author

jayvdb commented Jan 9, 2022

After fixing Django 4 renames, ShowUrlsTests fail because the output has changed in Django 4

@adambalasis
Copy link

After that, lots of failures due to

[  125s]     from django.db.models.deletion import Collector
[  125s]     from django.utils import timezone
[  125s] >   from django.utils.encoding import force_str, smart_text
[  125s] E   ImportError: cannot import name 'smart_text' from 'django.utils.encoding' (/usr/lib/python3.9/site-packages/django/utils/encoding.py)
[  125s] 
[  125s] django_extensions/management/commands/dumpscript.py:44: ImportError

That particular issue is fixed by changing the import to from django.utils.encoding import force_str, smart_str as smart_text FWIW.

@adambalasis
Copy link

Apparently, from django.conf.urls import urlfrom django.conf.urls import re_path as url fixes that?

@jayvdb
Copy link
Contributor Author

jayvdb commented Feb 3, 2022

#1698 likely addresses this.

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

2 participants