diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 974adbf..c8623b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,6 +96,39 @@ jobs: - name: Tests run: pytest + freethreading: + # The free-threaded build is officially supported since Python 3.14 (PEP 779). + # The plugin coordinates reruns between xdist workers over a socket server + # with a thread per connection, so run the suite without the GIL to make + # sure that shared state stays safe. + name: free-threading:py-3.14t:pytest-9.1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7 + + - name: Set up Python + uses: actions/setup-python@v7 + with: + python-version: "3.14t" + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install pytest==9.1.* pytest-xdist + python -m pip install -e . + + - name: Verify the GIL stays disabled + # Importing an extension that does not declare free-threading support + # re-enables the GIL, which would make this job silently pointless. + run: | + python -c " + import sys, pytest, xdist, pytest_rerunfailures + assert not sys._is_gil_enabled(), 'importing the test dependencies re-enabled the GIL' + " + + - name: Tests + run: pytest + platform: # Test devel setup on different platforms. name: Platform-${{ matrix.os }} diff --git a/changes/361.misc.rst b/changes/361.misc.rst new file mode 100644 index 0000000..e2d69de --- /dev/null +++ b/changes/361.misc.rst @@ -0,0 +1 @@ +Test the free-threaded Python 3.14 build in CI, via a new ``py314t`` tox environment and a matching workflow job. diff --git a/tox.ini b/tox.ini index cb3e45e..b069bbe 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ envlist = linting py{310,311,312,313,314,py3}-pytest{82,83,84,90,91,main} py314-pytest91-xdist + py314t-pytest91-xdist docs minversion = 4.0