Skip to content

Enable testing on Python 3.12 #400

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

Merged
merged 6 commits into from
Dec 1, 2023
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
5 changes: 3 additions & 2 deletions .github/workflows/UnitTesting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ jobs:
py39: 3.9
py310: '3.10'
py311: '3.11'
py312: '3.12'
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: Should have worked at the time with 3.12.0-beta - 3.12. But it's available now, see https://github.com/actions/python-versions/blob/main/versions-manifest.json

Maybe rebase to trigger a rerun?

DB_DATABASE: test_db
DB_USER: root
DB_PASSWORD: root
strategy:
fail-fast: false
matrix:
python-version: [py37, py38, py39, py310, py311]
python-version: [py37, py38, py39, py310, py311, py312]
testenv: [core, ext]
steps:
- name: Checkout repo
Expand All @@ -40,7 +41,7 @@ jobs:
python-version: ${{ env[matrix.python-version] }}

- name: Install tox
run: pip install "tox<=3.27.1" -U tox-factor
run: pip install "tox<=3.27.1" -U tox-factor setuptools

- name: Cache tox environment
# Preserves .tox directory between runs for faster installs
Expand Down
49 changes: 26 additions & 23 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
[tox]
skip_missing_interpreters = True
envlist =
py{37,38,39,310,311}-core
py{37,38,39,310,311,312}-core

py{37,38,39,310,311}-ext-aiobotocore
py{37,38,39,310,311,312}-ext-aiobotocore

py{37,38,39,310,311}-ext-aiohttp
py{37,38,39,310,311,312}-ext-aiohttp

py{37,38,39,310,311}-ext-botocore
py{37,38,39,310,311,312}-ext-botocore

py{37,38,39,310,311}-ext-bottle
py{37,38,39,310,311,312}-ext-bottle

py{37,38,39}-ext-django-2

py{37,38,39,310}-ext-django-3

; Django4 is only for python 3.8+
py{38,39,310,311}-ext-django-4
py{38,39,310,311,312}-ext-django-4

py{37,38,39,310,311}-ext-flask
py{37,38,39,310,311,312}-ext-flask

py{37,38,39,310,311}-ext-flask_sqlalchemy
py{37,38,39,310,311,312}-ext-flask_sqlalchemy

py{37,38,39,310,311}-ext-httplib
py{37,38,39,310,311,312}-ext-httplib

py{37,38,39,310,311}-ext-httpx
py{37,38,39,310,311,312}-ext-httpx

py{37,38,39,310,311}-ext-pg8000
py{37,38,39,310,311,312}-ext-pg8000

py{37,38,39,310,311}-ext-psycopg2
py{37,38,39,310,311,312}-ext-psycopg2

py{37,38,39,310,311}-ext-pymysql
py{37,38,39,310,311,312}-ext-pymysql

py{37,38,39,310,311}-ext-pynamodb
py{37,38,39,310,311,312}-ext-pynamodb

py{37,38,39,310,311}-ext-requests
py{37,38,39,310,311,312}-ext-requests

py{37,38,39,310,311}-ext-sqlalchemy
py{37,38,39,310,311,312}-ext-sqlalchemy

py{37,38,39,310,311}-ext-sqlalchemy_core
py{37,38,39,310,311,312}-ext-sqlalchemy_core

py{37,38,39,310,311}-ext-sqlite3
py{37,38,39,310,311,312}-ext-sqlite3

[testenv]
passenv = TOXENV,CI,CODECOV_*
Expand All @@ -56,7 +56,10 @@ deps =
wrapt

; Python 3.5+ only deps
py{37,38,39,310,311}: pytest-asyncio
py{37,38,39,310,311,312}: pytest-asyncio

; For pkg_resources
py{37,38,39,310,311,312}: setuptools
Copy link
Contributor

Choose a reason for hiding this comment

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

I am still not very clear on why this dependency is needed. You mentioned it was added since a test imports pkg_resources, which test are you referring to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The pkg_resources module is deprecated, but this test appears to be intentionally and specifically verifying compatibility with it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably only “necessary” on Python 3.12 though:

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

https://docs.python.org/3.12/whatsnew/3.12.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps, but it’s not harmful on others. The dependency is still real; it’s just allowed to be implicit. I guess I can change to py312 only if implicit is better than explicit.


ext-aiobotocore: aiobotocore >= 0.10.0
ext-aiobotocore: pytest-asyncio
Expand Down Expand Up @@ -89,15 +92,15 @@ deps =
ext-django-4: Django >=4.0,<5.0
ext-django: django-fake-model

py{37,38,39,310,311}-ext-pynamodb: pynamodb >=3.3.1
py{37,38,39,310,311,312}-ext-pynamodb: pynamodb >=3.3.1

ext-psycopg2: psycopg2
ext-psycopg2: testing.postgresql

ext-pg8000: pg8000 <= 1.20.0
ext-pg8000: testing.postgresql

py{37,38,39,310,311}-ext-pymysql: pymysql >= 1.0.0
py{37,38,39,310,311,312}-ext-pymysql: pymysql >= 1.0.0

setenv =
DJANGO_SETTINGS_MODULE = tests.ext.django.app.settings
Expand All @@ -107,7 +110,7 @@ setenv =
commands =
coverage erase

py{37,38,39,310,311}-core: coverage run --append --source aws_xray_sdk -m pytest --ignore tests/ext {posargs}
py{37,38,39,310,311,312}-core: coverage run --append --source aws_xray_sdk -m pytest --ignore tests/ext {posargs}

ext-aiobotocore: coverage run --append --source aws_xray_sdk -m pytest tests/ext/aiobotocore {posargs}

Expand Down Expand Up @@ -139,7 +142,7 @@ commands =

ext-sqlalchemy: coverage run --append --source aws_xray_sdk -m pytest tests/ext/sqlalchemy {posargs}

py{37,38,39,310,311}-ext-sqlalchemy_core: coverage run --append --source aws_xray_sdk -m pytest tests/ext/sqlalchemy_core {posargs}
py{37,38,39,310,311,312}-ext-sqlalchemy_core: coverage run --append --source aws_xray_sdk -m pytest tests/ext/sqlalchemy_core {posargs}

ext-sqlite3: coverage run --append --source aws_xray_sdk -m pytest tests/ext/sqlite3 {posargs}

Expand Down