Skip to content

Forward host pytest arguments to in-worker pytest - #274

Merged
hoodmane merged 2 commits into
cloudflare:mainfrom
hoodmane:hoodmane/forward-test-args
Sep 25, 2026
Merged

hoodmane merged 2 commits into
cloudflare:mainfrom
hoodmane:hoodmane/forward-test-args

Conversation

@hoodmane

Copy link
Copy Markdown
Contributor

And also change the test names to match between in-worker pytest session and host pytest session.

This makes -k work as expected.

Register each in-worker suite on the host under its file name
and mirror in-worker test classes as nested classes.

This is intended so that passing a `-k` filter picks up the same tests both
inside and outside of the worker.
… run

The host sends its invocation arguments as repeated `?arg=` query parameters on
`/run-tests/<suite>`, and `TestRunner.run_suite` appends them to
`pytest.main`. So `-x`, `-v`, `--tb`, `-W`, `-k` etc. now apply inside
the worker too.

For `-k`, the host also sends the keywords that only exist on the host
as `?kw=`; `ExtraKeywordsPlugin` attaches them to the in-worker items so the
same expression selects the same tests on both sides.

Tge FastAPI test worker uses `TestRunner` directly so it builds a
`RunSuiteRequest` from the query string.
@hoodmane
hoodmane merged commit 223c175 into cloudflare:main Sep 25, 2026
17 checks passed
@hoodmane
hoodmane deleted the hoodmane/forward-test-args branch September 25, 2026 03:01
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.

2 participants