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

Python312 upgrade #357

Merged
merged 7 commits into from
Apr 18, 2024
Merged
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
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-20.04]
python-version: ['3.8']
toxenv: [py38-django32, py38-django42]
python-version: ['3.12']
toxenv: [py312-django32, py312-django42]

steps:
- uses: actions/checkout@v4
Expand All @@ -35,6 +35,13 @@ jobs:
env:
TOXENV: ${{ matrix.toxenv }}
run: tox

- name: Upload coverage to CodeCov
if: matrix.python-version == '3.12' && matrix.toxenv == 'py312-django42'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false

- name: Run Integration Tests
run: |
Expand All @@ -46,7 +53,7 @@ jobs:
DEVSTACK_WORKSPACE=$PWD/.. docker-compose -f docker-compose.yml -f docker-compose-host.yml run -v $PWD/../edx-sga:/edx-sga lms /edx-sga/run_devstack_integration_tests.sh

- name: Upload coverage to CodeCov
if: matrix.python-version == '3.8' && matrix.toxenv == 'py38-django42'
if: matrix.python-version == '3.12' && matrix.toxenv == 'py312-django42'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
Expand Down
15 changes: 15 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
coverage:
status:
project:
default:
enabled: yes
target: 90%
patch:
default:
enabled: yes
target: 55%

comment:
layout: "reach, diff, flags, files"
behavior: default
require_changes: false
2 changes: 1 addition & 1 deletion edx_sga/sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from xblock.exceptions import JsonHandlerError
from xblock.fields import DateTime, Float, Integer, Scope, String
from web_fragments.fragment import Fragment
from xblockutils.studio_editable import StudioEditableXBlockMixin
from xblock.utils.studio_editable import StudioEditableXBlockMixin
from xmodule.contentstore.content import StaticContent
from xmodule.util.duedate import get_extended_due_date

Expand Down
12 changes: 10 additions & 2 deletions edx_sga/tests/test_sga.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,11 @@ def personalize_upload(self, block, upload):
"""
Set values on block from file upload.
"""
now = datetime.datetime.utcnow().replace(
try:
now = datetime.datetime.now(datetime.UTC) # pylint: disable=no-member
except: # pylint: disable=bare-except
now = datetime.datetime.utcnow()
now = now.replace(
tzinfo=pytz.timezone(getattr(settings, "TIME_ZONE", pytz.utc.zone))
)
block.annotated_mimetype = mimetypes.guess_type(upload.file.name)[0]
Expand Down Expand Up @@ -744,11 +748,15 @@ def test_prepare_download_submissions_task_called(
Test prepare download api
"""
block = self.make_xblock()
try:
timestamp = datetime.datetime.now(datetime.UTC) # pylint: disable=no-member
except: # pylint: disable=bare-except
timestamp = datetime.datetime.utcnow()
get_sorted_submissions.return_value = [
{
"submission_id": uuid.uuid4().hex,
"filename": f"test_{uuid.uuid4().hex}.txt",
"timestamp": datetime.datetime.utcnow(),
"timestamp": timestamp,
}
for __ in range(2)
]
Expand Down
4 changes: 2 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
# SERIOUSLY.
#
# ------------------------------
# Generated by edx-lint version: 5.3.4
# Generated by edx-lint version: 5.3.6
# ------------------------------
[MASTER]
ignore =
Expand Down Expand Up @@ -386,4 +386,4 @@ int-import-graph =
[EXCEPTIONS]
overgeneral-exceptions = builtins.Exception

# ff64c395f281daac14346c8f9bfe2e4b246e1b3b
# ded156569e874a59e79c78b1abd83116d0ef6f0d
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def package_data(pkg, root_list):
"Framework :: Django :: 4.2",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Education",
],
Expand Down
6 changes: 3 additions & 3 deletions test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ ddt==1.6.0
djangorestframework
django-storages
edx-celeryutils==1.2.3
edx-lint==5.3.4
edx-lint==5.3.6
edx-opaque-keys
edx-submissions==3.6.0
jsonfield==3.1.0
mako==1.2.4
pdbpp==0.10.3
pylint==2.17.5
pylint==3.0.3
pylint-celery==0.3
pylint-django==2.5.3
pylint-django==2.5.5
pyOpenSSL==23.2.0
pytz==2023.3
pytest==7.4.2
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{38}-django{32,42}
envlist = py{312}-django{32,42}

[testenv]
passenv =
Expand Down
Loading