Skip to content

Commit

Permalink
ci: add tests for 3.13t and pypy 3.10 (#27)
Browse files Browse the repository at this point in the history
* ci: add tests for 3.13t and pypy 3.10

* skip uvloop tests on free-threaded build

* only test 32-bit windows with latest Python

* add rust toolchain hint
  • Loading branch information
davidhewitt authored Nov 22, 2024
1 parent 6a29511 commit 57f1688
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
fail-fast: false # If one platform fails, allow the rest to keep testing.
matrix:
rust: [stable]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "pypy-3.9", "pypy-3.10"]
platform:
[
{
Expand All @@ -65,11 +65,6 @@ jobs:
python-architecture: "x64",
rust-target: "x86_64-pc-windows-msvc",
},
{
os: "windows-latest",
python-architecture: "x86",
rust-target: "i686-pc-windows-msvc",
},
]
exclude:
# PyPy doesn't release 32-bit Windows builds any more
Expand All @@ -89,7 +84,7 @@ jobs:

# Test the `nightly` feature
- rust: nightly
python-version: "3.12"
python-version: "3.13"
platform:
{
os: "ubuntu-latest",
Expand All @@ -99,11 +94,16 @@ jobs:
msrv: "nightly"
extra_features: "nightly"

# Test 32-bit windows just on latest Python
- rust: stable
python-version: "3.13"
platform: { os: "windows-latest", python-architecture: "x86", rust-target: "i686-pc-windows-msvc" }

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: Quansight-Labs/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.platform.python-architecture }}
Expand All @@ -125,8 +125,8 @@ jobs:
- name: Build
run: cargo build --features=${{env.features}} --verbose --target ${{ matrix.platform.rust-target }}

# uvloop doesn't compile under Windows and PyPy
- if: ${{ matrix.platform.os != 'windows-latest' && !startsWith(matrix.python-version, 'pypy') }}
# uvloop doesn't compile under Windows and PyPy, nor for free-threaded Python
- if: ${{ matrix.platform.os != 'windows-latest' && !startsWith(matrix.python-version, 'pypy') && !endsWith(matrix.python-version, 't') }}
name: Install pyo3-asyncio test dependencies
run: |
python -m pip install -U uvloop
Expand Down
8 changes: 8 additions & 0 deletions pytests/test_async_std_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ fn main() -> pyo3::PyResult<()> {
pyo3::prepare_freethreaded_python();

Python::with_gil(|py| {
// uvloop not supported on the free-threaded build yet
// https://github.com/MagicStack/uvloop/issues/642
let sysconfig = py.import("sysconfig")?;
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
if is_freethreaded.is_truthy()? {
return Ok(());
}

let uvloop = py.import("uvloop")?;
uvloop.call_method0("install")?;

Expand Down
8 changes: 8 additions & 0 deletions pytests/test_tokio_current_thread_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ fn main() -> pyo3::PyResult<()> {
});

Python::with_gil(|py| {
// uvloop not supported on the free-threaded build yet
// https://github.com/MagicStack/uvloop/issues/642
let sysconfig = py.import("sysconfig")?;
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
if is_freethreaded.is_truthy()? {
return Ok(());
}

let uvloop = py.import("uvloop")?;
uvloop.call_method0("install")?;

Expand Down
8 changes: 8 additions & 0 deletions pytests/test_tokio_multi_thread_uvloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ fn main() -> pyo3::PyResult<()> {
pyo3::prepare_freethreaded_python();

Python::with_gil(|py| {
// uvloop not supported on the free-threaded build yet
// https://github.com/MagicStack/uvloop/issues/642
let sysconfig = py.import("sysconfig")?;
let is_freethreaded = sysconfig.call_method1("get_config_var", ("Py_GIL_DISABLED",))?;
if is_freethreaded.is_truthy()? {
return Ok(());
}

let uvloop = py.import("uvloop")?;
uvloop.call_method0("install")?;

Expand Down

0 comments on commit 57f1688

Please sign in to comment.