Skip to content

ci: run the test suite inside real Pyodide, as an advisory job - #976

Closed
ddivyanshsharmaa wants to merge 2 commits into
petercorke:mainfrom
ddivyanshsharmaa:ci/pyodide-tests
Closed

ddivyanshsharmaa wants to merge 2 commits into
petercorke:mainfrom
ddivyanshsharmaa:ci/pyodide-tests

Conversation

@ddivyanshsharmaa

@ddivyanshsharmaa ddivyanshsharmaa commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This follows up my comment on #633. It adds an advisory test-pyodide job that runs the non-slow test suite inside real Pyodide under Node, on every PR, in parallel with the other jobs.

  • docs/lite/wasm_check/run_pytest.mjs installs the pure-Python wheel through the real notebook bootstrap, the same way check_pyodide_install.mjs does. It copies tests/ (and the files some tests read) into Pyodide's filesystem and runs pytest. pytest-timeout is disabled because Pyodide has no signal.setitimer, and capture is sys because Pyodide has no file-descriptor capture.
  • tests/conftest.py keeps every browser-only rule in one place, and the rules are active only when sys.platform == "emscripten". Desktop runs collect and run exactly the same tests as before.
    • Skipped, with a reason per group: no subprocesses; no git for robot_descriptions; the teach panel refusing to run under Jupyter; bdsim not installed by the bootstrap; and tests that expect window-mode rendering.
    • Marked as non-strict xfail: the four real findings from my comment (the movie getframe canvas, int32 path hashes, negative dt inline, and the default backend being ignored). They stay visible and will show as XPASS when each is fixed. This PR does not fix them.
  • The job uses Node 26 rather than the 22 in docs.yml, because the notebook-bootstrap tests call asyncio.run() inside Pyodide. That needs WebAssembly stack switching (JSPI), which Node 22 lacks.
  • The job is advisory, like mypy: it has continue-on-error and is not in All tests passed. It can be made required once it has a record of green runs.
  • docs/lite/wasm_check/README.md says how to run the job locally and how to skip a browser-only test.

There are no changes to the toolbox code and no change in numerical results or public behaviour.

Related issue

Refs #633. It covers the "real Pyodide" half. The pure-Python desktop half is already done by #946.

What I ran

  • A trial PR on my fork, with the same workflow, on ubuntu-latest with Pyodide 314.0.6 and Node 26.13.1: 2159 passed, 347 skipped, 9 xfailed, 1 xpassed, 0 failed, in 2 min 49 s.
    • The 9 xfails are the 5 known-failure tests plus the 4 failing sub-cases of test_book_paths_are_unchanged. The xpass is that test's parent, which completes because its failing sub-cases are already recorded.
  • On the same trial run, the existing desktop matrix and All tests passed stayed green with the new conftest.py.
  • Locally on Windows, I ran the full desktop suite with and without this change. It has the same skip and xfail counts, and the only failures are the same robot_descriptions/__version__ ones that this machine has on unchanged main.

Codacy

Codacy's 11 findings are all in run_pytest.mjs. Ten flag readFileSync/readdirSync with a non-literal path (ESLint detect-non-literal-fs-filename and the matching Semgrep rule), and one flags the usage message passed to console.error. The paths are the repository's own files and the wheel built in the same job, and check_pyodide_install.mjs reads files the same way (lines 47–48). Following CONTRIBUTING, I have left the code as it is rather than rewriting it for the advisory check.

AI disclosure

This change was written with Claude Code (Claude Opus 5.5) and OpenAI Codex. I read the diff and checked the CI runs myself.

🤖 Generated with Claude Code

ddivyanshsharmaa and others added 2 commits November 18, 2026 15:56
run_pytest.mjs installs the pure-Python wheel through the notebook
bootstrap, as check_pyodide_install.mjs does, and runs the non-slow suite
in Pyodide under Node.  Tests that need what a browser cannot provide
(subprocesses, git for robot_descriptions, the teach panel, bdsim,
window-mode rendering) are skipped there with a reason, in one place in
tests/conftest.py; nothing changes on desktop.

Four real findings from petercorke#633 are marked xfail under Pyodide, so the job
is green while they stay visible: the movie getframe canvas, int32 path
hashes, a negative dt in inline mode, and the browser ignoring the
default backend.

The job is advisory, like mypy, until it has a record of green runs.

Refs petercorke#633

Co-Authored-By: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>
Co-Authored-By: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 5 critical · 6 high

Alerts:
⚠ 11 issues (≤ 0 issues of at least minor severity)

Results:
11 new issues

Category Results
Security 5 critical
6 high

View in Codacy

🟢 Metrics 20 complexity · 0 duplication

Metric Results
Complexity 20
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@ddivyanshsharmaa

Copy link
Copy Markdown
Contributor Author

Closing this for now to keep my open PRs within the limit you asked for, while #961 and #962 wait for review. The branch stays at ci/pyodide-tests on my fork, so if you'd like the Pyodide job after looking at my comment on #633, it can be reopened as it is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant