Skip to content

Commit 7da7496

Browse files
authored
try testing and building for 3.12 (#629)
1 parent a63621a commit 7da7496

File tree

7 files changed

+26
-16
lines changed

7 files changed

+26
-16
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ jobs:
7070
- '3.9'
7171
- '3.10'
7272
- '3.11'
73+
- '3.12-dev'
7374
- 'pypy3.7'
7475
- 'pypy3.8'
7576
- 'pypy3.9'
@@ -301,15 +302,15 @@ jobs:
301302
platform: linux
302303
- os: windows
303304
ls: dir
304-
interpreter: 3.7 3.8 3.9 3.10 3.11 pypy3.8 pypy3.9
305+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12 pypy3.8 pypy3.9
305306
- os: windows
306307
ls: dir
307308
target: i686
308309
python-architecture: x86
309-
interpreter: 3.7 3.8 3.9 3.10 3.11
310+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12
310311
- os: macos
311312
target: aarch64
312-
interpreter: 3.7 3.8 3.9 3.10 3.11
313+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12
313314
- os: ubuntu
314315
platform: linux
315316
target: i686
@@ -323,7 +324,7 @@ jobs:
323324
platform: linux
324325
target: armv7
325326
container: messense/manylinux_2_24-cross:armv7
326-
interpreter: 3.7 3.8 3.9 3.10 3.11
327+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12
327328
# musllinux
328329
- os: ubuntu
329330
platform: linux
@@ -337,12 +338,12 @@ jobs:
337338
platform: linux
338339
target: ppc64le
339340
container: messense/manylinux_2_24-cross:ppc64le
340-
interpreter: 3.7 3.8 3.9 3.10 3.11
341+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12
341342
- os: ubuntu
342343
platform: linux
343344
target: s390x
344345
container: messense/manylinux_2_24-cross:s390x
345-
interpreter: 3.7 3.8 3.9 3.10 3.11
346+
interpreter: 3.7 3.8 3.9 3.10 3.11 3.12
346347
exclude:
347348
# Windows on arm64 only supports Python 3.11+
348349
- os: windows
@@ -377,7 +378,7 @@ jobs:
377378
target: ${{ matrix.target }}
378379
manylinux: ${{ matrix.manylinux || 'auto' }}
379380
container: ${{ matrix.container }}
380-
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 pypy3.7 pypy3.8 pypy3.9' }}
381+
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.7 3.8 3.9 3.10 3.11 3.12 pypy3.7 pypy3.8 pypy3.9' }}
381382
rust-toolchain: stable
382383
docker-options: -e CI
383384

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ url = "2.3.1"
4242
idna = "0.3.0"
4343
base64 = "0.13.1"
4444
num-bigint = "0.4.3"
45+
python3-dll-a = "0.2.7"
4546

4647
[lib]
4748
name = "_pydantic_core"

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
'Programming Language :: Python :: 3.9',
2222
'Programming Language :: Python :: 3.10',
2323
'Programming Language :: Python :: 3.11',
24+
'Programming Language :: Python :: 3.12',
2425
'Programming Language :: Rust',
2526
'Framework :: Pydantic',
2627
'Intended Audience :: Developers',
@@ -62,7 +63,13 @@ isort = { known-first-party = ['pydantic_core', 'tests'] }
6263
[tool.pytest.ini_options]
6364
testpaths = 'tests'
6465
log_format = '%(name)s %(levelname)s: %(message)s'
65-
filterwarnings = 'error'
66+
filterwarnings = [
67+
'error',
68+
# Work around https://github.com/pytest-dev/pytest/issues/10977 for Python 3.12
69+
'ignore:(ast\.Str|ast\.NameConstant|ast\.Num|Attribute s) is deprecated and will be removed.*:DeprecationWarning:',
70+
# issue with pytz - https://github.com/stub42/pytz/issues/105 for Python 3.12
71+
'ignore:datetime\.utcfromtimestamp\(\) is deprecated.*:DeprecationWarning:',
72+
]
6673
timeout = 30
6774
xfail_strict = true
6875
# min, max, mean, stddev, median, iqr, outliers, ops, rounds, iterations

tests/benchmarks/test_micro_benchmarks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ class CoreModel:
760760

761761
@pytest.fixture(scope='class')
762762
def datetime_raw(self):
763-
return datetime.utcnow().replace(tzinfo=timezone.utc) + timedelta(days=1)
763+
return datetime.now(timezone.utc) + timedelta(days=1)
764764

765765
@pytest.fixture(scope='class')
766766
def datetime_str(self, datetime_raw):

tests/validators/test_date.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_date_future(py_and_json: PyAndJson, input_value, expected):
275275

276276
def test_date_past_future_today():
277277
v = SchemaValidator(core_schema.date_schema(now_op='past', now_utc_offset=0))
278-
today = datetime.utcnow().replace(tzinfo=timezone.utc).date()
278+
today = datetime.now(timezone.utc).date()
279279
assert v.isinstance_python(today) is False
280280
assert v.isinstance_python(today - timedelta(days=1)) is True
281281
assert v.isinstance_python(today + timedelta(days=1)) is False

tests/validators/test_datetime.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_datetime_past(py_and_json: PyAndJson, input_value, expected):
307307

308308
def test_datetime_past_timezone():
309309
v = SchemaValidator(core_schema.datetime_schema(now_utc_offset=0, now_op='past'))
310-
now_utc = datetime.utcnow().replace(tzinfo=timezone.utc) - timedelta(seconds=1)
310+
now_utc = datetime.now(timezone.utc) - timedelta(seconds=1)
311311
assert v.isinstance_python(now_utc)
312312
# "later" in the day
313313
assert v.isinstance_python(now_utc.astimezone(pytz.timezone('Europe/Istanbul')))
@@ -350,7 +350,7 @@ def test_datetime_future(py_and_json: PyAndJson, input_value, expected):
350350

351351
def test_datetime_future_timezone():
352352
v = SchemaValidator(core_schema.datetime_schema(now_utc_offset=0, now_op='future'))
353-
now_utc = datetime.utcnow().replace(tzinfo=timezone.utc)
353+
now_utc = datetime.now(timezone.utc)
354354

355355
soon_utc = now_utc + timedelta(minutes=1)
356356
assert v.isinstance_python(soon_utc)
@@ -376,10 +376,10 @@ def test_mock_utc_offset_8_hours(mocker):
376376
"""
377377
mocker.patch('time.localtime', return_value=type('time.struct_time', (), {'tm_gmtoff': 8 * 60 * 60}))
378378
v = SchemaValidator(core_schema.datetime_schema(now_op='future'))
379-
future = datetime.utcnow() + timedelta(hours=8, minutes=1)
379+
future = datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(hours=8, minutes=1)
380380
assert v.isinstance_python(future)
381381

382-
future = datetime.utcnow() + timedelta(hours=7, minutes=59)
382+
future = datetime.now(timezone.utc).replace(tzinfo=None) + timedelta(hours=7, minutes=59)
383383
assert not v.isinstance_python(future)
384384

385385

0 commit comments

Comments
 (0)