(session: nox.Session)
| 262 | |
| 263 | @nox.session(name="test-examples-emscripten") |
| 264 | def test_examples_emscripten(session: nox.Session): |
| 265 | session.install(".", "build") |
| 266 | |
| 267 | session.run( |
| 268 | "rustup", |
| 269 | "component", |
| 270 | "add", |
| 271 | "rust-src", |
| 272 | "--toolchain", |
| 273 | "nightly", |
| 274 | external=True, |
| 275 | ) |
| 276 | examples_dir = Path("examples").absolute() |
| 277 | test_crates = [ |
| 278 | examples_dir / "html-py-ever", |
| 279 | examples_dir / "namespace_package", |
| 280 | ] |
| 281 | |
| 282 | python_version = os.environ["PYTHON_VERSION"] |
| 283 | emscripten_version = os.environ["EMSCRIPTEN_VERSION"] |
| 284 | |
| 285 | with tempfile.NamedTemporaryFile("w") as pyo3_config: |
| 286 | pyo3_config.write(f"""\ |
| 287 | implementation=CPython |
| 288 | version={python_version} |
| 289 | shared=true |
| 290 | abi3=false |
| 291 | pointer_width=32 |
| 292 | """) |
| 293 | pyo3_config.flush() |
| 294 | |
| 295 | emscripten_version_joined = emscripten_version.replace(".", "_") |
| 296 | |
| 297 | for example in test_crates: |
| 298 | env = os.environ.copy() |
| 299 | env.update( |
| 300 | RUSTUP_TOOLCHAIN="nightly", |
| 301 | PYTHONPATH=str(EMSCRIPTEN_DIR), |
| 302 | _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata__emscripten_wasm32-emscripten", |
| 303 | _PYTHON_HOST_PLATFORM=f"emscripten_{emscripten_version_joined}_wasm32", |
| 304 | CARGO_BUILD_TARGET="wasm32-unknown-emscripten", |
| 305 | CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_LINKER=str( |
| 306 | EMSCRIPTEN_DIR / "emcc_wrapper.py" |
| 307 | ), |
| 308 | PYO3_CONFIG_FILE=pyo3_config.name, |
| 309 | ) |
| 310 | with session.chdir(example): |
| 311 | cmd = ["python", "-m", "build", "--wheel", "--no-isolation"] |
| 312 | session.run(*cmd, env=env, external=True) |
| 313 | |
| 314 | with session.chdir(EMSCRIPTEN_DIR): |
| 315 | session.run("node", "runner.js", str(example), external=True) |
| 316 | |
| 317 | |
| 318 | @nox.session(name="bump-version") |
nothing calls this directly
no test coverage detected
searching dependent graphs…