Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
sudo apt-get install -y build-essential default-jdk
- name: Test with pytest
run: |
pytest moodleteacher/tests/test_fake_mode.py moodleteacher/tests/test_validation.py
4 changes: 2 additions & 2 deletions moodleteacher/requests.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import collections
import collections.abc
import requests
from unittest.mock import Mock

Expand Down Expand Up @@ -76,7 +76,7 @@ def _encode_param(self, params, key, value):
Convert Python sequences to numbered JSON list,
and Python numbers to strings.
"""
if isinstance(value, collections.Sequence) and not isinstance(value, str):
if isinstance(value, collections.abc.Sequence) and not isinstance(value, str):
for i, v in enumerate(value):
self._encode_param(params, "{}[{}]".format(key, i), v)
return
Expand Down
2 changes: 1 addition & 1 deletion moodleteacher/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def from_json(cls, raw_json):
obj.id_ = raw_json['id']
obj.fullname = raw_json.get('fullname', '')
obj.email = raw_json.get('email', '')
obj.groups = raw_json.get('email', [])
obj.groups = raw_json.get('groups', [])
return obj

@classmethod
Expand Down