Skip to content

ChannelsLiveServerTestCase fails with django 5.2 #2148

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

Open
devkral opened this issue Apr 8, 2025 · 6 comments
Open

ChannelsLiveServerTestCase fails with django 5.2 #2148

devkral opened this issue Apr 8, 2025 · 6 comments

Comments

@devkral
Copy link
Contributor

devkral commented Apr 8, 2025

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.

@carltongibson
Copy link
Member

@devkral Can you make a pr?

@AlexShonia
Copy link

AlexShonia commented May 8, 2025

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'...

@carltongibson
Copy link
Member

Yep, django/django@8eca3e9 changed the behaviour here.

@devkral
Copy link
Contributor Author

devkral commented May 9, 2025

sry not much time, currently quite busy

@pandafy
Copy link

pandafy commented May 9, 2025

@carltongibson I think we would need a Django project to test ChannelsLiveServerTestCase. I don't see existing tests for this class right now.

@carltongibson
Copy link
Member

@pandafy Yes, we could add a small test project to the test suite.

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

4 participants