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

[WIP][Update] Django Channels #8

Closed
wants to merge 1 commit into from

Conversation

atb00ker
Copy link
Member

@atb00ker atb00ker commented Aug 29, 2018

## Do not Merge ##
Tasks remaining before Merge:

  • I am unable to write the test case for the test_update_location() with the new version of channels, i need help with it.
  • Edit README to include steps for Async Testing.
  • Edit .travis.yml file for running Async Tests and ensure they are sending their test report for coverage.
  • Edit README to add compatibility table of django-loci & python. Example
  • Does routing.py belong to .coveragerc, under omit section? The file is called during the tests yet that doesn't reflect in the coverage!

WIP: #7

PR Forwarded, Please Read: #9

Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's looking promising @atb00ker 👍

@atb00ker atb00ker force-pushed the issues/7 branch 2 times, most recently from 74121e9 to 8050054 Compare August 30, 2018 12:12
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working to fix the outstanding issues, so you don't need to change this PR (please don't introduce changes or I won't be able to merge easily).

I'm leaving some comments about minor things only so that you can learn to avoid those in the future ok?

@@ -0,0 +1,3 @@
#!/bin/bash
set -e
pytest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that the final new line at the end of the file is missing, you may need to configure your editor to add finalnew lines automatically

[pytest]
DJANGO_SETTINGS_MODULE = tests.test_settings
# -- read python files format:
python_files = pytest_*.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that the final new line at the end of the file is missing, you may need to configure your editor to add finalnew lines automatically

try:
from .local_settings import *
except: #noqa
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this file really needed? local_settings is already imported in settings.py so why not use the main settings directly?
If we can avoid adding files we should do so, the less code we have to maintain, the better.


script:
- coverage run --source=django_loci runtests.py
- py.test --cov=django_loci
- coverage run -a --source=django_loci runtests.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if you manage to call pytests in runtests.py we may be able to fix coverage

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The coverage from both the tests is added.
-a option in coverage run -a --source=django_loci runtests.py appends the results from tests to the results of py.test --cov=django_loci.
The problem is only with one file routing.py

try:
user = self.scope["user"]
self.pk = self.scope['url_route']['kwargs']['pk']
except Exception:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

catching the generic Exception is generally a bad practice

'''
In channels 2.x, Websockets can only be tested
asynchronously, hence, pytest is used for these tests.
'''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for consistency, use double quotes for docstrings

@nemesifier nemesifier added this to To do (general) in OpenWISP Contributor's Board via automation Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
@nemesifier nemesifier mentioned this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
nemesifier added a commit that referenced this pull request Sep 2, 2018
Copy link
Member

@nemesifier nemesifier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks a lot @atb00ker, I've merged manually in #9

@nemesifier nemesifier closed this Sep 2, 2018
OpenWISP Contributor's Board automation moved this from To do (general) to Done Sep 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants