django / channels

Developer-friendly asynchrony for Django

Home Page:https://channels.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does ChannelsLiveServerTestCase support running test in parallel?

qiu-lijie opened this issue · comments

Does ChannelsLiveServerTestCase support running test in parallel?

I'm writing some test using ChannelsLiveServerTestCase, but when ran with the --parallel option, I get the following error

Traceback (most recent call last):
  File "/home/qiu_lijie/.local/lib/python3.8/site-packages/django/test/testcases.py", line 287, in _setup_and_call
    self._pre_setup()
  File "/home/qiu_lijie/.local/lib/python3.8/site-packages/channels/testing/live.py", line 52, in _pre_setup
    self._server_process.start()
  File "/usr/local/lib/python3.8/multiprocessing/process.py", line 118, in start
    assert not _current_process._config.get('daemon'), \
AssertionError: daemonic processes are not allowed to have children

After a bit of digging, it SEEMS like just monkey patching out the assertion check in multiprocessing allows tests to run w/o adverse affect, but I want to confirm whether this is a known issue/intended result. I can't seem to find any mention of ChannelsLiveServerTestCase cannot be run in parallel in the documentation, and it seems necessary given the fact that selenium/end to end tests run much slower.

Hi @qiu-lijie — I can't reproduce this on main with the test case from the tutorial.

Ref ChannelsLiveServerTestCase in general I've merged #1906 to enforce fork here, which at least lets test cases work on macOS. (We'll need a fuller solution long-term, and for Windows support.)

Note pre-4.0 this requires the development version of daphne as well. See #1898

If you can provide a reproduce on main, I'm happy to look. Otherwise I'll close as needsinfo.