Skip to content

Commit fd55a40

Browse files
authored
MOTOR-1160 Test against Python 3.12 (#216)
1 parent f179495 commit fd55a40

File tree

3 files changed

+44
-9
lines changed

3 files changed

+44
-9
lines changed

.evergreen/config.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,10 @@ axes:
863863
variables:
864864
TOX_ENV: "tornado6-py311"
865865
PYTHON_BINARY: "/opt/python/3.11/bin/python3"
866+
- id: "tornado6-py312"
867+
variables:
868+
TOX_ENV: "tornado6-py312"
869+
PYTHON_BINARY: "/opt/python/3.12/bin/python3"
866870
- id: "tornado_git-py38"
867871
variables:
868872
TOX_ENV: "tornado_git-py38"
@@ -891,6 +895,10 @@ axes:
891895
variables:
892896
TOX_ENV: "asyncio-py311"
893897
PYTHON_BINARY: "/opt/python/3.11/bin/python3"
898+
- id: "asyncio-py312"
899+
variables:
900+
TOX_ENV: "asyncio-py312"
901+
PYTHON_BINARY: "/opt/python/3.12/bin/python3"
894902
- id: "py3-pymongo-latest"
895903
variables:
896904
TOX_ENV: "py3-pymongo-latest"
@@ -899,6 +907,10 @@ axes:
899907
variables:
900908
TOX_ENV: "synchro37"
901909
PYTHON_BINARY: "/opt/python/3.7/bin/python3"
910+
- id: "synchro312"
911+
variables:
912+
TOX_ENV: "synchro312"
913+
PYTHON_BINARY: "/opt/python/3.12/bin/python3"
902914

903915
- id: tox-env-rhel7
904916
display_name: "Tox Env RHEL7"
@@ -982,7 +994,7 @@ buildvariants:
982994
# TODO: synchro needs PyMongo's updated SSL test certs,
983995
# which may require Motor test suite changes.
984996
- os: "*"
985-
tox-env: ["synchro37"]
997+
tox-env: ["synchro37", "synchro312"]
986998
ssl: "ssl"
987999
tasks:
9881000
- ".rapid"
@@ -1040,7 +1052,7 @@ buildvariants:
10401052

10411053
- matrix_name: "enterprise-auth"
10421054
display_name: "Enterprise Auth-${tox-env}"
1043-
matrix_spec: {"tox-env": ["synchro37"], ssl: "ssl"}
1055+
matrix_spec: {"tox-env": ["synchro37", "synchro312"], ssl: "ssl"}
10441056
run_on:
10451057
- "rhel84-small"
10461058
tasks:

setup.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,15 @@ def run(self):
122122
runner_kwargs = dict(verbosity=2, failfast=self.failfast)
123123

124124
if self.xunit_output:
125-
runner_kwargs["output"] = self.xunit_output
126-
from xmlrunner import XMLTestRunner
127-
128-
runner_class = XMLTestRunner
129-
else:
125+
try:
126+
from xmlrunner import XMLTestRunner
127+
except ImportError:
128+
self.xunit_output = False
129+
else:
130+
runner_kwargs["output"] = self.xunit_output
131+
runner_class = XMLTestRunner
132+
133+
if not self.xunit_output:
130134
import unittest
131135

132136
runner_class = unittest.TextTestRunner

tox.ini

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ envlist =
99
tornado5-{py37},
1010

1111
# Tornado 6 supports Python 3.5+.
12-
tornado6-{pypy37,py37,py38,py39,py310,py311},
12+
tornado6-{pypy37,py37,py38,py39,py310,py311,py312},
1313

1414
# Test Tornado's dev version in a few configurations.
1515
tornado_git-{py38},
@@ -21,13 +21,14 @@ envlist =
2121
py3-sphinx-doctest,
2222

2323
# asyncio without Tornado.
24-
asyncio-{py37,py38,py39,py310,py311},
24+
asyncio-{py37,py38,py39,py310,py311,py312},
2525

2626
# Test with the latest PyMongo.
2727
py3-pymongo-latest,
2828

2929
# Apply PyMongo's test suite to Motor via Synchro.
3030
synchro37
31+
synchro312
3132

3233
# Run pre-commit on all files.
3334
lint
@@ -58,9 +59,11 @@ basepython =
5859
py39: {env:PYTHON_BINARY:python3.9}
5960
py310: {env:PYTHON_BINARY:python3.10}
6061
py311: {env:PYTHON_BINARY:python3.11}
62+
py312: {env:PYTHON_BINARY:python3.12}
6163
pypy37: {env:PYTHON_BINARY:pypy3}
6264

6365
synchro37: {env:PYTHON_BINARY:python3.7}
66+
synchro312: {env:PYTHON_BINARY:python3.12}
6467

6568
# Default Python 3 when we don't care about minor version.
6669
py3,lint,manifest: {env:PYTHON_BINARY:python3}
@@ -72,6 +75,8 @@ deps =
7275

7376
{py37,py38,py39,py310,py311}: aiohttp
7477

78+
py312: setuptools
79+
7580
sphinx: sphinx
7681
sphinx: aiohttp
7782
sphinx: tornado
@@ -81,6 +86,10 @@ deps =
8186
synchro37: tornado>=6,<7
8287
synchro37: nose
8388

89+
synchro312: tornado>=6,<7
90+
synchro312: pynose
91+
synchro312: setuptools
92+
8493
pypy37: cryptography<3
8594

8695
setenv =
@@ -128,6 +137,16 @@ commands =
128137
python3 -m pip install -e {envtmpdir}/mongo-python-driver
129138
python3 -m synchro.synchrotest --with-xunit --xunit-file=xunit-synchro-results -v -w {envtmpdir}/mongo-python-driver {posargs}
130139

140+
[testenv:synchro312]
141+
allowlist_externals =
142+
git
143+
setenv =
144+
PYTHONPATH = {envtmpdir}/mongo-python-driver
145+
commands =
146+
git clone --depth 1 --branch master https://github.com/mongodb/mongo-python-driver.git {envtmpdir}/mongo-python-driver
147+
python3 -m pip install -e {envtmpdir}/mongo-python-driver
148+
python3 -m synchro.synchrotest -v -w {envtmpdir}/mongo-python-driver {posargs}
149+
131150
[testenv:lint]
132151
deps =
133152
pre-commit

0 commit comments

Comments
 (0)