fix(tests): forward pytest flags without requiring -- separator - #42195
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(tests): forward pytest flags without requiring -- separator#42195liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
Use parse_known_args instead of parse_args in run_tests_parallel.py so that pytest flags (e.g. -q, -k, --tb=long) passed after test paths without a literal '--' separator are captured as unrecognized args and forwarded to each per-file pytest invocation. Closes NousResearch#42189
1 task
Contributor
|
Thanks for the focused test-runner fix. This is already implemented on current
|
This was referenced Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
scripts/run_tests.shso that pytest flags (e.g.-q,-k,--tb=long) passed after test paths work without requiring a literal--separator. Previously,scripts/run_tests.sh tests/foo.py -qwould fail with an argparse error.Related Issue
Fixes #42189
Type of Change
Changes Made
scripts/run_tests_parallel.py: Useparse_known_argsinstead ofparse_argsso unrecognized pytest flags are captured and forwarded to each per-file pytest invocationscripts/run_tests.sh: Update usage comment to show that--is now optionaltests/scripts/test_run_tests_parallel.py: Add 6 tests verifying argument parsing for various invocation styles (with/without separator, multiple flags, mixed runner+pytest flags)How to Test
scripts/run_tests.sh tests/test_run_tests_parallel.py -q— should succeed (previously failed with argparse error)scripts/run_tests.sh tests/test_run_tests_parallel.py -- -q— should still work (backward compat)scripts/run_tests.sh -j 2 tests/test_run_tests_parallel.py -k "test_" --tb=short— runner's-jparsed, pytest flags forwardedpython -m pytest tests/scripts/test_run_tests_parallel.py -v— all 6 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
scripts/run_tests_parallel.py(argparse logic),scripts/run_tests.sh(usage docs)parse_known_argsis the standard argparse approach for mixed known/unknown flags