Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
with:
python-version: '3.12'
- name: Install tox
run: pip install tox==4.26.0
run: pip install tox==4.53.1
- name: Setup tox environment
run: tox run -e ${{ env.TOXENV }} --notest
- name: Test
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ jobs:
toxenv: py
tox_extra_args: "-n 4"
test_mypyc: true
- name: Test suite with py315-ubuntu, mypyc-compiled
python: '3.15'
os: ubuntu-24.04-arm
toxenv: py
tox_extra_args: "-n 4"
test_mypyc: true
- name: Test suite with py314t-ubuntu, mypyc-compiled
python: '3.14t'
os: ubuntu-24.04-arm
Expand Down Expand Up @@ -196,6 +202,7 @@ jobs:
if: ${{ !(matrix.debug_build || endsWith(matrix.python, '-dev')) }}
with:
python-version: ${{ matrix.python }}
allow-prereleases: true

- name: Install tox
run: |
Expand All @@ -206,7 +213,7 @@ jobs:
echo debug build; python -c 'import sysconfig; print(bool(sysconfig.get_config_var("Py_DEBUG")))'
echo os.cpu_count; python -c 'import os; print(os.cpu_count())'
echo os.sched_getaffinity; python -c 'import os; print(len(getattr(os, "sched_getaffinity", lambda *args: [])(0)))'
pip install tox==4.26.0
pip install tox==4.53.1
- name: Compiled with mypyc
if: ${{ matrix.test_mypyc }}
Expand Down Expand Up @@ -271,7 +278,7 @@ jobs:
default: 3.11.1
command: python -c "import platform; print(f'{platform.architecture()=} {platform.machine()=}');"
- name: Install tox
run: pip install tox==4.26.0
run: pip install tox==4.53.1
- name: Setup tox environment
run: tox run -e py --notest
- name: Test
Expand Down
5 changes: 4 additions & 1 deletion mypyc/test-data/run-misc.test
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,10 @@ print(z)
[case testCheckVersion]
import sys

if sys.version_info[:2] == (3, 15):
if sys.version_info[:2] == (3, 16):
def version() -> int:
return 16
elif sys.version_info[:2] == (3, 15):
def version() -> int:
return 15
elif sys.version_info[:2] == (3, 14):
Expand Down
3 changes: 2 additions & 1 deletion mypyc/test-data/run-python312.test
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ type C[*Ts] = tuple[*Ts]
def test_type_var_tuple_type_alias() -> None:
if sys.version_info >= (3, 15): # type: ignore[operator]
assert str(C[int, str]) == "_frozen_importlib.C[int, str]"
assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[~Ts]]"
else:
assert str(C[int, str]) == "C[int, str]"
assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[Ts]]"
assert str(getattr(C, "__value__")) == "tuple[typing.Unpack[Ts]]"

type D[**P] = Callable[P, int]

Expand Down
15 changes: 13 additions & 2 deletions mypyc/test/test_emit.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import sys
import unittest

from mypyc.codegen.emit import Emitter, EmitterContext
Expand Down Expand Up @@ -42,7 +43,12 @@ def test_reg(self) -> None:

def test_object_annotation(self) -> None:
assert self.emitter.object_annotation("hello, world", "line;") == " /* 'hello, world' */"
assert self.emitter.object_annotation(list(range(30)), "line;") == """\
if sys.version_info >= (3, 15):
assert self.emitter.object_annotation(list(range(30)), "line;") == """\
/* [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29] */"""
else:
assert self.emitter.object_annotation(list(range(30)), "line;") == """\
/* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29] */"""

Expand All @@ -57,7 +63,12 @@ def test_emit_line(self) -> None:
emitter.emit_line("CPyStatics[0];", ann="hello, world")
emitter.emit_line("CPyStatics[1];", ann=list(range(30)))
assert emitter.fragments[0] == "CPyStatics[0]; /* 'hello, world' */\n"
assert emitter.fragments[1] == """\
if sys.version_info >= (3, 15):
assert emitter.fragments[1] == """\
CPyStatics[1]; /* [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
20, 21, 22, 23, 24, 25, 26, 27, 28, 29] */\n"""
else:
assert emitter.fragments[1] == """\
CPyStatics[1]; /* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29] */\n"""

Expand Down
4 changes: 2 additions & 2 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ mypy-extensions==1.1.0
# via -r mypy-requirements.txt
nodeenv==1.9.1
# via pre-commit
packaging==25.0
packaging==26.2
# via pytest
pathspec==1.0.0
# via -r mypy-requirements.txt
Expand All @@ -46,7 +46,7 @@ pre-commit==4.3.0
# via -r test-requirements.in
psutil==7.1.0
# via -r test-requirements.in
pygments==2.19.2
pygments==2.20.0
# via pytest
pytest==8.4.2
# via
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ envlist =
py312,
py313,
py314,
py315,
docs,
lint,
type,
Expand Down
Loading