8000 mach: Allow filtering tests in `mach test-devtools` by delan · Pull Request #38514 · servo/servo · GitHub
[go: up one dir, main page]

Skip to content

Conversation

delan
Copy link
Member

@delan delan commented Aug 7, 2025

mach test-devtools uses unittest without unittest.main(), so we can parse arguments and set up the test runner how we want, but this means there’s currently no way to filter tests on the command line.

this patch plumbs the positional arguments (if any) into the TestLoader’s testNamePatterns, with extra logic to treat any pattern pattern not containing * like *pattern*. this is the same behaviour as unittest.main() -k:

$ ./mach test-devtools domparser responsexml
Running devtools tests...
Running 2 tests:
- test_source_content_inline_script_with_domparser (servo.devtools_tests.DevtoolsTests.test_source_content_inline_script_with_domparser)
- test_source_content_inline_script_with_responsexml (servo.devtools_tests.DevtoolsTests.test_source_content_inline_script_with_responsexml)

test_source_content_inline_script_with_domparser (servo.devtools_tests.DevtoolsTests.test_source_content_inline_script_with_domparser) ... ok
test_source_content_inline_script_with_responsexml (servo.devtools_tests.DevtoolsTests.test_source_content_inline_script_with_responsexml) ... ok

----------------------------------------------------------------------
Ran 2 tests in 4.055s

OK

Testing: not really worth automated testing, but tested manually above
Fixes: part of #36325

Signed-off-by: Delan Azabani <dazabani@igalia.com>
@delan delan requested a review from atbrakhi August 7, 2025 10:16
@delan delan mentioned this pull request Jul 30, 2025
7 tasks
Signed-off-by: Delan Azabani <dazabani@igalia.com>
delan added a commit that referenced this pull request Aug 7, 2025
Signed-off-by: Delan Azabani <dazabani@igalia.com>
@delan delan added this pull request to the merge queue Aug 7, 2025
Merged via the queue into main with commit 8cfd82f Aug 7, 2025
22 checks passed
@delan delan deleted the mach-test-devtools-filter branch August 7, 2025 13:50
@delan delan mentioned this pull request Aug 7, 2025
81 tasks
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
0