pytest-dev / pytest-dev/pytest
Forcing `--capture=sys` without passing the CLI flag seems impossible?
@goodboy is already working on this.
Since Jun 29, 2026.
- Dominant language
- Python
- Stars
- 14.5k
- Forks
- 3.4k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 35
Description
-
a detailed description of the bug or problem you are having
i want to dynamically forcecapsysin certain specialized cases (specifically using anos.fork()ing process spawning backend intractor) but haven't been able to figure out a way using what i thought should be the right hook:pytest_load_initial_conftests(). -
output of
pip listfrom the virtual environment you are using
don't think this is relevant? (but i'll put it if y'all think it's not just noise) -
pytest and operating system versions
- pytest 8.3.5 (yeah yeah i know i gotta update 😝)
- nixos.
-
minimal example if possible
i have the above hook implemented in a way that detects the passed CLI opts and tries to force it by appending to
argshere,
https://github.com/goodboy/tractor/pull/447/changes#r3198334549
i then have a dynamic fixture requesting fixture here which tries to do something similar on a per-test declaration basis here,
https://github.com/goodboy/tractor/pull/447/changes#r3198340745
I'm wondering if what i'm doing is expected to work or not?
Ideally we can allow users to run our test suite without having to fail-early-after-pytest invocation when they do not pass pytest --capture=sys, IOW if a certain backend is parametrized into the overall run (specifially in our case with --spawn-backend=main_thread_forkserver) then we want to automatically apply as though pytest --capture=sys --spawn-backend=<backend> as well?
Please lmk what info is necessary to dig into this.
Also obviously yell at me about updating the pytest version (which we're already getting nudged about).
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.
Assessment
This issue has not been assessed yet.