Answer the question
In order to leave comments, you need to log in
How to properly test Django channels?
Good day to all!
Actually a question on a subject.
I read the docks, it’s not clear such a moment where the tests should be stored and how to run them? Now I have them in the standard Django test file, but when the tests are run, the tests for channels do not run ...
What is the best way to organize tests of channels along with a Django application?
Answer the question
In order to leave comments, you need to log in
Hello.
That's what it says in the doc - put it in the tests.py file.
If you have other tests there besides those for channels and they work, then check that you have added the TEST argument to the DATABASES dictionary of the settings.py file.
"We need to tell our project that the sqlite3 database needs not to be in memory for run the tests."
# mysite/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'TEST': {
'NAME': os.path.join(BASE_DIR, 'db_test.sqlite3')
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question