Skip to content
This repository was archived by the owner on May 12, 2022. It is now read-only.

Commit 11273ab

Browse files
authored
Merge pull request #219 from eduNEXT/lmm/py38
[BD-6] Upgrade requirements and add python 3.8 tests
2 parents ef448f5 + ceffc23 commit 11273ab

File tree

20 files changed

+125
-117
lines changed

20 files changed

+125
-117
lines changed

.travis.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
language: python
22

3-
matrix:
4-
include:
5-
- python: "3.5"
6-
env: DJANGO_SETTINGS_MODULE=settings
7-
script:
8-
- tox -e py35
9-
- ./node_modules/gulp/bin/gulp.js test
10-
- bash ./run_bokchoy_tests.sh
3+
python:
4+
- 3.5
5+
- 3.8
6+
7+
envs:
8+
- TOXENV=django22
9+
- TOXENV=quality
10+
11+
script:
12+
- tox
13+
- ./node_modules/gulp/bin/gulp.js test
14+
- bash ./run_bokchoy_tests.sh
1115

1216
addons:
1317
firefox: "46.0"

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ upgrade: ## update the requirements/*.txt files with the latest packages satisfy
33
pip install -q pip-tools
44
pip-compile --upgrade -o requirements/base.txt requirements/base.in
55
pip-compile --upgrade -o requirements/testing.txt requirements/testing.in
6+
# Let tox control the Django version for tests
7+
grep -e "^django==" requirements/base.txt > requirements/django.txt
8+
sed -i.tmp '/^[dD]jango==/d' requirements/testing.txt
9+
rm requirements/testing.txt.tmp
10+

edx_notifications/base_data.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ class Dict(dict):
4747
Create a subclass of dict to make it weak referencable
4848
per https://docs.python.org/2/library/weakref.html
4949
"""
50-
pass
5150

5251

53-
class TypedField(object):
52+
class TypedField:
5453
"""
5554
Field Decscriptors used to enforce correct typing
5655
"""
@@ -417,7 +416,7 @@ def validate(self):
417416
Validations should throw a ValidationError if there
418417
is a problem.
419418
"""
420-
pass # this intentionally does nothing
419+
# this intentionally does nothing
421420

422421

423422
class RelatedObjectField(TypedField):

edx_notifications/channels/link_resolvers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def resolve(self, msg_type_name, link_name, params, exact_match_only=False):
105105
return None
106106

107107

108-
class MsgTypeToUrlResolverMixin(object):
108+
class MsgTypeToUrlResolverMixin:
109109
"""
110110
Helper mix-in class to share logic when channels need to use
111111
similar link resolvers

edx_notifications/channels/tests/test_parse_push.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from edx_notifications.channels.parse_push import _PARSE_SERVICE_USER_ID, ParsePushNotificationChannelProvider
2020

2121

22-
class MockCrashingParsePush(object):
22+
class MockCrashingParsePush:
2323
"""
2424
Simulate an exception
2525
"""

edx_notifications/lib/tests/test_lib.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_bulk_publish_list(self):
254254

255255
# now send to more than our internal chunking size
256256
bulk_publish_notification_to_users(
257-
[user_id for user_id in range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1)],
257+
list(range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1)),
258258
msg
259259
)
260260

@@ -282,8 +282,8 @@ def test_bulk_publish_list_exclude(self):
282282
}
283283
)
284284

285-
user_ids = [user_id for user_id in range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1)]
286-
exclude_user_ids = [user_id for user_id in range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1, 2)]
285+
user_ids = list(range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1))
286+
exclude_user_ids = list(range(1, const.NOTIFICATION_BULK_PUBLISH_CHUNK_SIZE * 2 + 1, 2))
287287

288288
# now send to more than our internal chunking size
289289
bulk_publish_notification_to_users(

edx_notifications/openedx/group_project.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
GROUP_PROJECT_RENDERER_PREFIX = 'edx_notifications.openedx.group_project'
2020

2121

22-
class NotificationMessageTypes(object):
22+
class NotificationMessageTypes:
2323
"""
2424
Message type constants
2525
"""

edx_notifications/renderers/basic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class UnderscoreStaticFileRenderer(BaseNotificationRenderer):
6464
underscore_template_name = None
6565
underscore_template = None
6666

67-
def __init__(self, template_name=None):
67+
def __init__(self, template_name=None): # pylint: disable=super-init-not-called
6868
"""
6969
Initializer
7070
"""

edx_notifications/scopes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def resolve(self, scope_name, scope_context, instance_context):
3131
raise NotImplementedError()
3232

3333

34-
class SingleUserScopeResolver(object):
34+
class SingleUserScopeResolver:
3535
"""
3636
Simple implementation for scope_name='user' where there must
3737
be a user_id inside the scope_context

edx_notifications/server/api/consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _get_parameters_from_request(request, allowed_parameters):
7979
raise ValueError(
8080
"Passed in expected bool '{val}' does not map to True or False".format(val=str_val)
8181
)
82-
elif filter_type == str or filter_type == six.text_type:
82+
elif filter_type in (str, six.text_type):
8383
value = str_val
8484
else:
8585
raise ValueError('Unknown parameter type {name}'.format(name=filter_type))

0 commit comments

Comments
 (0)