-
-
Notifications
You must be signed in to change notification settings - Fork 13
Implement tag filtering #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Implement tag filtering #234
Conversation
modules/core/shared/src/main/scala/weaver/internals/TagExprParser.scala
Outdated
Show resolved
Hide resolved
| def unsafeFromPattern(pattern: String): Wildcard = | ||
| fromPattern(pattern).leftMap { e => | ||
| new RuntimeException( | ||
| s"The pattern: ${pattern} is not a valid tag wildcard. ${e}") | ||
| }.fold(throw _, identity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost only for testing purposes, we could use literally instead as, for testing, the pattern is always known at compile time
modules/core/shared/src/main/scala/weaver/internals/TagExpr.scala
Outdated
Show resolved
Hide resolved
modules/core/shared/src/main/scala/weaver/internals/TagExpr.scala
Outdated
Show resolved
Hide resolved
|
Thanks @filosganga ! I've added some ideas to the issue #233 (comment), suggesting that we improve support for |
This PR is an attempt to achieve #233.
Summary
This PR adds tag-based test filtering using GitHub's label filtering syntax with wildcard pattern matching support. Users can now filter tests by tags using the
-t/--tagsflag with expressive boolean logic and wildcards.Changes
Core Implementation
TagExpr.scala- Tag expression AST withAtom,Wildcard,Not,And,OrnodesGithubTagExprParser.scala- Parser for GitHub-style syntax (replaces PyTest-styleTagExprParser),for OR operator(space) for AND operator!for NOT operator()for groupingWildcardpattern matching - Using cats-parse combinators*matches zero or more characters?matches exactly one characterbug-*,*-prod,first*bug,test-?Filters.scala- Integration with existing filtering infrastructureTests
TagExprTests.scala- Comprehensive wildcard pattern parsing and matching testsGithubTagExprParserTests.scala- Parser syntax tests with GitHub-style expressionsDocumentation
filtering.md- Complete guide on pattern and tag-based filteringtagging.md- How to add tags and naming conventions.tagged()method usage.ignoreand.onlyREADME.md- Overview of the new tag filtering featureBreaking Changes
-o/--only) continues to work unchanged.tagged(),.ignore,.only) continues to work unchangedDependencies
cats-parsefrom0.3.10to1.0.0(required for.soft/.backtrackAPIs)Examples
Run tests tagged as "bug" OR "feature":
Run tests tagged as both "integration" AND "database":
Run all tests except "slow" ones:
Run bug-related tests, excluding wontfix:
Run all tests matching bug-* pattern:
Run tests matching environment pattern:
Complex expression with grouping:
Combine tag and pattern filters: