Hi,
I am using django5.0 and trying to run the test suite but i am getting the following error.
(dec_23_django_test) [ surshaw_lifo_issue ] bash-4.4$ ./runtests.py --settings=test_oracle --v=2
Traceback (most recent call last):
File “/home/surshaw/dec_23_django_test/django/tests/./runtests.py”, line 33, in
from django.utils.version import PY312, PYPY
ImportError: cannot import name ‘PYPY’ from ‘django.utils.version’ (/home/surshaw/.virtualenvs/dec_23_django_test/lib/python3.11/site-packages/django/utils/version.py)
What can be the workaround for this import issue.
Hmmmmm
Alright, what ticket are you working on? Seems you want to run the test suite on 5.0 (curious why not main?) and using oracle settings (what is your setup here?).
Testing against other backends is tricky.
Are you using django-docker-box?
Doesn’t look like you’re using tox ![:thinking: :thinking:](https://emoji.discourse-cdn.com/twitter/thinking.png?v=12)
So, for us to help, please share what you are trying to acheive and why and what steps you took (around setup) to get to that error.
I am testing django test suite with oracle db for any issues. I have created a test_oracle.py file which contains db configuration and then using the command “./runtest.py --settings=test_oracle.py”
Contents of test_oracle.py file
from test_sqlite import *
DATABASES = {
‘default’: {
‘ENGINE’:‘django.db.backends.oracle’,
‘NAME’:‘localhost:51521/ORCLPDB1’,
‘USER’:‘XXXXX’,
‘PASSWORD’:‘XXXXX’,
‘TEST’: {
‘USER’: ‘default_test1612’,
‘TBLSPACE’: ‘default_test_t1612’,
‘TBLSPACE_TMP’: ‘default_test_tbls_tmp1261’,
},
},
‘other’:{
‘ENGINE’:‘django.db.backends.oracle’,
‘NAME’:‘localhost:51521/ORCLPDB1’,
‘USER’:‘XXXX’,
‘PASSWORD’:‘XXXX’,
‘TEST’: {
‘USER’: ‘other_test1612’,
‘TBLSPACE’: ‘other_test_tbls1621’,
‘TBLSPACE_TMP’: ‘other_test_tbls_tm1p161’,
},
},
}
It looks like you installed Django 5.0 but are trying to run the tests on Django’s main
branch. The PYPY
variable exists on the main
branch and not on the stable/5.0.x
branch. You should instead install Django using pip install -e /path/to/your/local/clone/django/
.
3 Likes
@timgraham
now i am getting another issue.
Traceback (most recent call last):
File “/home/surshaw/dec_23_django_test/django/tests/./runtests.py”, line 28, in
from django.test.runner import get_max_test_processes, parallel_type
File “/home/surshaw/.local/lib/python3.12/site-packages/Django-5.1.dev20240108190724-py3.12.egg/django/test/runner.py”, line 2, in
import ctypes
File “/tmp/3962127755/python/lib/python3.12/ctypes/init.py”, line 8, in
ImportError: libffi.so.8: cannot open shared object file: No such file or directory.
I have used python setup.py build install to install django.
This has nothing to do with Django. If you have missing C-libraries try to find a package that provides them, e.g. libffi-dev
and install it.