-
-
Notifications
You must be signed in to change notification settings - Fork 80
[change:tests] Switch to ChannelsLiveServerTestCase #466 #465
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
base: master
Are you sure you want to change the base?
[change:tests] Switch to ChannelsLiveServerTestCase #466 #465
Conversation
Replaced StaticLiveServerTestCase with ChannelsLiveServerTestCase to resolve JS errors caused by failed websocket connections. Fixes openwisp#466
ee2d9f8
to
3d223e8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks on the right track to me.
Question: how can we be sure it's working as expected and there's no JS errors?
Wouldn't it make sense to add at least one test for this?
CI is not passing on Django 5.2, why is that?
'ENGINE': 'django.db.backends.sqlite3', | ||
'NAME': 'openwisp_utils.db', | ||
'TEST': { | ||
'NAME': 'openwisp_utils_test.db', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
Without this, it was causing this error
raise ImproperlyConfigured(
django.core.exceptions.ImproperlyConfigured: ChannelLiveServerTestCase can not be used with in memory databases
As the ASGI server requires a physical database
|
||
|
||
class TestMenu(SeleniumTestMixin, StaticLiveServerTestCase): | ||
class TestMenu(SeleniumTestMixin, ChannelsLiveServerTestCase): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's tag all these tests (as we're doing in other modules for the selenium tests) so we can exclude them from the parallel run.
@@ -86,7 +86,7 @@ jobs: | |||
- name: Tests | |||
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }} | |||
run: | | |||
coverage run runtests.py --parallel | |||
coverage run runtests.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we have tagged the tests, we can modify the runtests.py script to handle which tests must not be run in parallel.
Since this can get complex in each module, I insisted with @pandafy that we hide this complexity from contributors in the runtests.py
script, which thanks to a few lines of comments is also useful to us maintainers to remember why it's done that way.
See the runtests.py script in the controller module:
https://github.com/openwisp/openwisp-controller/blob/master/runtests.py#L46-L47
There is an open issue in django channels for ChannelsLiveServerTestCase is broken in django 5.2 |
Replaced StaticLiveServerTestCase with ChannelsLiveServerTestCase to resolve JS errors caused by failed websocket connections.
Fixes #466
Checklist
Reference to Existing Issue
Closes #466.
Description of Changes
Issues