Skip to content

Forcing --capture=sys without passing the CLI flag seems impossible? #14444

@goodboy

Description

@goodboy
  • a detailed description of the bug or problem you are having
    i want to dynamically force capsys in certain specialized cases (specifically using an os.fork()ing process spawning backend in tractor) 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 list from 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 args here,

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    platform: linuxlinux platform-specific problemplugin: capturerelated to the capture builtin plugintype: questiongeneral question, might be closed after 2 weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions