mirror of
https://github.com/django/daphne.git
synced 2025-04-20 00:32:09 +03:00
Added a unit-test for the system check.
This commit is contained in:
parent
09c43f4c81
commit
79abfaeb20
2
setup.py
2
setup.py
|
@ -25,7 +25,7 @@ setup(
|
|||
install_requires=["twisted[tls]>=22.4", "autobahn>=22.4.2", "asgiref>=3.5.2,<4"],
|
||||
python_requires=">=3.7",
|
||||
setup_requires=["pytest-runner"],
|
||||
extras_require={"tests": ["hypothesis", "pytest", "pytest-asyncio"]},
|
||||
extras_require={"tests": ["hypothesis", "pytest", "pytest-asyncio", "django"]},
|
||||
entry_points={
|
||||
"console_scripts": ["daphne = daphne.cli:CommandLineInterface.entrypoint"]
|
||||
},
|
||||
|
|
21
tests/test_checks.py
Normal file
21
tests/test_checks.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
import django
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
|
||||
from daphne.checks import check_daphne_installed
|
||||
|
||||
|
||||
def test_check_daphne_installed():
|
||||
"""
|
||||
Test check error is raised if daphne is not listed before staticfiles, and vice versa.
|
||||
"""
|
||||
settings.configure(
|
||||
INSTALLED_APPS=["daphne.apps.DaphneConfig", "django.contrib.staticfiles"]
|
||||
)
|
||||
django.setup()
|
||||
errors = check_daphne_installed(None)
|
||||
assert len(errors) == 0
|
||||
with override_settings(INSTALLED_APPS=["django.contrib.staticfiles", "daphne"]):
|
||||
errors = check_daphne_installed(None)
|
||||
assert len(errors) == 1
|
||||
assert errors[0].id == "daphne.E001"
|
Loading…
Reference in New Issue
Block a user