checkpoint: finished test curation
This commit is contained in:
16
run_tests.py
16
run_tests.py
@@ -69,6 +69,7 @@ Example usage:
|
||||
help="Category of tests to run (e.g., 'unit', 'integration')."
|
||||
)
|
||||
|
||||
# Parse known arguments for the script itself, then parse remaining args for pytest
|
||||
args, remaining_pytest_args = parser.parse_known_args(sys.argv[1:])
|
||||
|
||||
selected_test_files = []
|
||||
@@ -104,18 +105,15 @@ Example usage:
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# Combine selected test files with any remaining pytest arguments
|
||||
# If --manifest was not provided, selected_test_files will be empty.
|
||||
# If no tests were selected from manifest/category, selected_test_files will be empty.
|
||||
pytest_command_args = selected_test_files + remaining_pytest_args
|
||||
# Combine selected test files with any remaining pytest arguments that were not parsed by this script.
|
||||
# We also filter out the literal '--' if it was passed by the user to avoid pytest errors if it appears multiple times.
|
||||
pytest_command_args = selected_test_files + [arg for arg in remaining_pytest_args if arg != '--']
|
||||
|
||||
# Filter out empty strings that might appear if remaining_pytest_args had them
|
||||
# Filter out any empty strings that might have been included.
|
||||
final_pytest_args = [arg for arg in pytest_command_args if arg]
|
||||
|
||||
# If no specific tests were selected and no manifest was provided,
|
||||
# and no other pytest args were given, pytest.main([]) runs default discovery.
|
||||
# This handles cases where user only passes pytest args like `python run_tests.py -- --cov=app`
|
||||
# or when manifest/category selection results in an empty list and no other args are passed.
|
||||
# If no specific tests were selected from manifest/category and no manifest was provided,
|
||||
# and no other pytest args were given, pytest.main([]) runs default test discovery.
|
||||
print(f"Running pytest with arguments: {final_pytest_args}", file=sys.stderr)
|
||||
sys.exit(pytest.main(final_pytest_args))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user