pytest-dev / pytest-dev/pytest
Support running pytest under WASI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
What's the problem this feature will solve?
I'm trying to run pytest under the WASI build of CPython, but pytest's extensive use of os.dup() prevents it from working.
If you're curious to reproduce:
- Grab a WASI build from https://github.com/tiran/cpython-wasm-test/releases
- Unpack it somewhere
- From the same directory where you unpacked
python.wasm:PIP_REQUIRE_VIRTUALENV=0 py -3.11 -m pip install --target . --only-binary=:all: --implementation=py --abi=none --abi=any pytest(if you don't have the Python Launcher, take out-3.11and add the pip flag--python_version="3.11") - Try running
wasmtime run --dir=. python.wasm -- -m pytest -h
It looks like:
is the first instance of os.dup() you run into, but even with --capture=no/s, you still run into:
Describe the solution you'd like
I would love to be able to provide instructions to projects on how to run pytest under WASI to see if their project is compatible.
Alternative Solutions
Additional context
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the WASI CPython build and the provided wasmtime command. Read src/_pytest/capture.py around line 381 and src/_pytest/faulthandler.py around line 29, then determine the scope of WASI-compatible handling; done means pytest can run under WASI and projects have usable instructions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, wasm
- Domain
- operating-systems, testing-qa
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100