channels
channels copied to clipboard
ChannelsLiveServerTestCase fails with django 5.2
Django 5.2 made TestCase._pre_setup a classmethod but this isn't reflected in ChannelsLifeServerTestCase.
This is leading to a crash when trying to use ChannelsLiveServerTestCase.
@devkral Can you make a pr?
Got the same issue here after following the channels tutorial:
(venv) ➜ meet-and-chat git:(main) ✗ python3 manage.py test app.meet_n_chat.tests
Found 2 test(s).
Creating test database for alias 'default'...
Destroying old test database for alias 'default'...
System check identified no issues (0 silenced).
E
======================================================================
ERROR: setUpClass (app.meet_n_chat.tests.ChatTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/alex/Projects/meet-and-chat/app/meet_n_chat/tests.py", line 14, in setUpClass
super().setUpClass()
File "/home/alex/Projects/meet-and-chat/venv/lib/python3.12/site-packages/django/test/testcases.py", line 1119, in setUpClass
cls._pre_setup()
TypeError: ChannelsLiveServerTestCase._pre_setup() missing 1 required positional argument: 'self'
----------------------------------------------------------------------
Ran 0 tests in 0.001s
FAILED (errors=1)
Destroying test database for alias 'default'...
Yep, https://github.com/django/django/commit/8eca3e9bce519c21340312ee7846c92b27abea79 changed the behaviour here.
sry not much time, currently quite busy
@carltongibson I think we would need a Django project to test ChannelsLiveServerTestCase. I don't see existing tests for this class right now.
@pandafy Yes, we could add a small test project to the test suite.
Hi @carltongibson, I'm currently working on a fix for this. I’ll keep you posted once it's ready.
Thanks @dee077 for starting https://github.com/django/channels/pull/2160. We need a solution for this issue in @openwisp and we're happy to help. We're open to suggestions. A big thanks in advance to the maintainers who'll help us out.
Thank you @dee077 for your work on PR #2160! This issue is currently preventing us (@goauthentik) from upgrading to Django 5.2. If there’s anything I can do to assist in resolving this, please let me know!