diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a6c12813..15ea2497 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: with: build-artifact-name: none build-artifact-path: none - pyodide-versions: "0.27.2,0.26.4" + pyodide-versions: "0.29.3,0.28.3,0.27.2,0.26.4" deploy: runs-on: ubuntu-24.04 diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 8cfb8969..d55e07b9 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -12,7 +12,11 @@ on: pyodide-version: required: false type: string - default: "0.27.2" + default: "0.29.3" + python-version: + required: false + type: string + default: "3.13" os: required: false type: string @@ -102,7 +106,7 @@ jobs: - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 with: - python-version: 3.12 + python-version: ${{ inputs.python-version }} - name: install pyodide-py run: | diff --git a/.github/workflows/testall.yaml b/.github/workflows/testall.yaml index f4d32454..0381345b 100644 --- a/.github/workflows/testall.yaml +++ b/.github/workflows/testall.yaml @@ -80,6 +80,7 @@ jobs: build-artifact-name: ${{ inputs.build-artifact-name }} build-artifact-path: ${{ inputs.build-artifact-path }} pyodide-version: ${{ matrix.pyodide_version }} + python-version: ${{ matrix.python_version }} os: ${{ matrix.os }} runner: ${{ matrix.runner }} browser: ${{ matrix.browser }} diff --git a/COMPATIBILITY.md b/COMPATIBILITY.md index d69621e3..73ee4d4c 100644 --- a/COMPATIBILITY.md +++ b/COMPATIBILITY.md @@ -3,16 +3,16 @@ Following versions of pytest-pyodide and Pyodide are tested in CI. Other versions may work, however with no guarantee. -| pytest-pyodide | Tested Pyodide versions | -| -------------- | ----------------------- | -| main branch | 0.26.4, 0.27.2 | -| 0.58.* | 0.24.1, 0.25.1, 0.26.1 | -| 0.57.* | 0.23.4, 0.24.1, 0.25.1 | -| 0.56.* | 0.23.4, 0.24.1 | -| 0.55.* | 0.23.4, 0.24.1 | -| 0.54.* | 0.23.4, 0.24.1 | -| 0.53.* | 0.23.2, 0.22.0 | -| 0.52.* | 0.23.2, 0.22.0 | -| 0.51.* | 0.23.2, 0.22.0, 0.21.3 | -| 0.50.* | 0.22.0, 0.21.3 | -| 0.23.* | 0.21.0 | +| pytest-pyodide | Tested Pyodide versions | +| -------------- | ------------------------------ | +| main branch | 0.26.4, 0.27.2, 0.28.3, 0.29.3 | +| 0.58.* | 0.24.1, 0.25.1, 0.26.1 | +| 0.57.* | 0.23.4, 0.24.1, 0.25.1 | +| 0.56.* | 0.23.4, 0.24.1 | +| 0.55.* | 0.23.4, 0.24.1 | +| 0.54.* | 0.23.4, 0.24.1 | +| 0.53.* | 0.23.2, 0.22.0 | +| 0.52.* | 0.23.2, 0.22.0 | +| 0.51.* | 0.23.2, 0.22.0, 0.21.3 | +| 0.50.* | 0.22.0, 0.21.3 | +| 0.23.* | 0.21.0 | diff --git a/tests/test_doctest.py b/tests/test_doctest.py index 114b23d2..923fc43e 100644 --- a/tests/test_doctest.py +++ b/tests/test_doctest.py @@ -1,3 +1,4 @@ +import re from pathlib import Path from textwrap import dedent @@ -83,19 +84,25 @@ def pytest_fixture_setup(self, fixturedef, request): result.assertoutcome(passed=2, failed=1) result.getfailures()[0] captured = capsys.readouterr() - # The indentation is different here in Python 3.12 vs Python 3.13... + # The indentation is different here in Python 3.12 vs Python 3.13 vs Python 3.14... expected = dedent( """ - 003 >>> from js import Object # doctest: +RUN_IN_PYODIDE - 004 >>> 1 == 2 + 003 >>> from js import Object # doctest: +RUN_IN_PYODIDE + 004 >>> 1 == 2 Expected: True Got: False """ ).strip() - print(captured.out) - assert expected in captured.out + + def normalize(s): + return re.sub(r" +>", " >", s) + + result = normalize(captured.out) + print(result) + + assert expected in result def test_doctest_collect(pytester): diff --git a/utils/build_test_matrix.py b/utils/build_test_matrix.py index 062138a9..a874f162 100644 --- a/utils/build_test_matrix.py +++ b/utils/build_test_matrix.py @@ -18,6 +18,27 @@ DEFAULT_PLAYWRIGHT_VERSION = "1.44.0" +@dataclasses.dataclass +class VersionPair: + pyodide_version: tuple[int, int] + python_version: str + + +PYODIDE_TO_PYTHON_VERSION: list[VersionPair] = [ + VersionPair(pyodide_version=(0, 28), python_version="3.13"), + VersionPair(pyodide_version=(0, 25), python_version="3.12"), + VersionPair(pyodide_version=(0, 23), python_version="3.11"), +] + + +def python_version_for_pyodide(pyodide_version: str) -> str: + pyodide_ver = tuple(int(x) for x in pyodide_version.split(".")[:2]) + for pair in PYODIDE_TO_PYTHON_VERSION: + if pyodide_ver >= pair.pyodide_version: + return pair.python_version + return "3.10" + + @dataclasses.dataclass class TestConfig: pyodide_version: str @@ -26,6 +47,7 @@ class TestConfig: browser: str browser_version: str = "" playwright_version: str = "" + python_version: str = "" @property def runtime(self) -> str: @@ -130,7 +152,13 @@ def build_configs(args: dict[str, list[str]]) -> list[TestConfig]: for _os, _pyodide_version, _runner, _browser in itertools.product( os, pyodide_version, runner, browser ): - config = TestConfig(_pyodide_version, _os, _runner, _browser) + config = TestConfig( + _pyodide_version, + _os, + _runner, + _browser, + python_version=python_version_for_pyodide(_pyodide_version), + ) if not is_valid_config(config): continue