Closed rfrenchseti closed 2 years ago
flush_statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list())
to:
flush_statements = connection.ops.sql_flush(style, tables)
from django.contrib.sessions.models import Session
Session.objects.all().delete()
Dave says:
I think it's ok for us to stay on Django 2.2 since it's still releasing new update (the latest 2.2.17 is expected to release on Nov). And at the same time we can wait for django_nose to release its new support on 3.1.x for the sql_flush, once it supports 3.1.x, we can upgrade to Django 3.1.x right away.
Note: To make django_nose sql_flush call work with Django 3.1.x, we can modify line 405 in runner.py (under site-pacakges/django_nose) by changing from:
flush_statements = connection.ops.sql_flush(style, tables, connection.introspection.sequence_list())
to:
flush_statements = connection.ops.sql_flush(style, tables)
With above modification, python manage.py test will run and pass, runserver will work fine too.
Deferring until django_nose is updated.
This is actually for Django 4.x now, as 3.x is starting its end-of-life journey soon.
Note that nose is not supported in Python 3.10 and should be replaced by pytest, see notes in this link: https://ipython.readthedocs.io/en/stable/whatsnew/version7.html
Upgrading to Django 4.x should be done at the same time as supporting Python 3.10. Currently OPUS doesn't work with 3.10 because some part of the Collections module was deprecated that was used by Django nose. Thus as part of fixing the tests for Django 4.x we should fix support for Python 3.10 as well.
https://docs.djangoproject.com/en/3.0/releases/3.0/