Skip to content
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

feat: fail on use ChannelsLiveServerTestCase when daphne is not installed #1943

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion channels/testing/live.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from functools import partial

from daphne.testing import DaphneProcess
try:
from daphne.testing import DaphneProcess
except ImportError:
DaphneProcess = None

from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler
from django.core.exceptions import ImproperlyConfigured
from django.db import connections
Expand Down Expand Up @@ -40,6 +44,9 @@ def live_server_ws_url(self):
return "ws://%s:%s" % (self.host, self._port)

def _pre_setup(self):
if self.ProtocolServerProcess is None:
raise ImproperlyConfigured("Daphne is not installed")

for connection in connections.all():
if self._is_in_memory_db(connection):
raise ImproperlyConfigured(
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ envlist =

[testenv]
usedevelop = true
extras = tests, daphne
extras = tests
commands =
pytest -v {posargs}
deps =
Expand Down