Repository navigation
Add category filtering to test selection - #65
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @Isadiksha0@gmail.com. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
lezama
left a comment
There was a problem hiding this comment.
Works as described. ruff, mypy and pytest (207 passed) are green here. Two things that cross files:
-
This conflicts with #63, which removes
difficulty. I merged the two branches locally:selection.py(module docstring) andtest_dataset_filtering.py(the helper passesdifficulty="basic") conflict, and after #63 theExecutionTestconstructor no longer acceptsdifficulty, so that helper would also fail at runtime. #63 lands first, then this branch rebases and drops the two spots flagged inline. The description line about preservingdifficultygoes away with it. -
A misspelled category is only an error when it is the only one.
--category hooks,typoruns the 6 hooks tests and says nothing abouttypo. Flagged inline with a fix.
On the Windows note in the description: checked the diff, no skip was added, so CI still runs those four tests.
| return tests | ||
|
|
||
| if categories: | ||
| requested_categories = set(categories) |
There was a problem hiding this comment.
If one requested category is unknown and another is valid, the unknown one is silently dropped (--category hooks,typo runs 6 hooks tests and says nothing). Let's compute unknown = requested_categories - {t.category for t in tests} here and raise ValueError naming them before filtering. The zero-tests message in core.py then stays as the fallback.
| assert selected_test_ids(selected) == [f"e-bbb-{i:03d}" for i in range(10)] | ||
|
|
||
|
|
||
| def test_unknown_category_raises_value_error_naming_category() -> None: |
There was a problem hiding this comment.
Let's add the mixed case too: categories=["bbb", "not-a-category"] should raise naming not-a-category. Today it returns the 10 bbb tests.
| expected_behavior="expected", | ||
| category="general", | ||
| category=category, | ||
| difficulty="basic", |
| @@ -7,6 +7,9 @@ | |||
| limited runs deterministic (same seed = same subset), tunable (different | |||
| seed = different subset), and representative (round-robin across | |||
| category/difficulty groups). | |||
| "scoring_version": SCORING_VERSION, | ||
| "seed": self.config.run.seed, | ||
| "limit": self.config.run.limit, | ||
| "categories": self.config.run.categories, |
There was a problem hiding this comment.
This records the config value, not what ran. With test_ids set the categories are ignored but still land in metadata. Let's write [] when test_ids wins, so a results file never claims a category filter that had no effect.
b3fc516 to
70d1de4
Compare
|
Thanks for the detailed review. I reb based the branch on trunk after #63, resolved the difficulty-related conflicts, added validation for mixed valid/unknown categories, and updated metadata to record an empty category list when explicit test IDs take precedence. All CI checks are now passing. |
lezama
left a comment
There was a problem hiding this comment.
thanks for addressing everything! rebased locally on current trunk, merges clean and ruff/mypy/pytest are green. lgtm :)
What
RunConfig.categories.--categoryCLI option.test_idsprecedence over categories.This is the category-only split requested in #56. It preserves the existing
limit,seed, and stratified-selection behavior.Why
This allows developers to run specific benchmark categories, such as
hooksorrest-api, without manually listing every test ID or running the entire dataset.Verification
ruff check pythonmypy pythonpytest pythonin CILocal full-suite result: 203 passed. Four environment-dependent tests could not complete on Windows because PHP was unavailable and one test expects a POSIX path.
Score impact
None. This adds a test-selection filter without changing scoring algorithms or benchmark datasets.