- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.7k
 
Test: Add way to discover and filter testsets by structure #59437
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: master
Are you sure you want to change the base?
Conversation
| 
           Two observations.. 
 
  | 
    
| 
           How does this handle custom   | 
    
| let | ||
| $(esc(tests)) | ||
| # Check if this testset should run based on filtering | ||
| local testset_id = generate_deterministic_testset_id($(string(source.file)), $(source.line), $desc) | 
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.
Does this mean that adding some newlines changes this ID? Or adding new lines to a macro wrapping @testset?
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.
The ID just needs to be stable between the discovery and runtime. It doesn't need to be stable otherwise.
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.
Is there any chance for this ending up in some cache that could cause these to go out of sync, e.g. in a language server?
| 
           I'm suspicious of doing this syntax based. I'd rather have something that e.g. redefines the testset macro in the current scope and then runs the tests. Syntax-based things tend to have ill-defined semantics.  | 
    
| 
           I think I agree. The amount of code required to make this syntax approach work on the stdlibs alone is huge, and likely to be incomplete and brittle. Redefining the macro for a standard run discovery phase, or a switch to disable code within the macro is the first approach I tried and failed at, but perhaps this PoC is enough to guide that to success.  | 
    
| 
           I've extended this to support   | 
    
c34c103    to
    a39d27a      
    Compare
  
    a39d27a    to
    2edd0a1      
    Compare
  
    
This is a proof of concept for testset filtering based on user specified strings or regexes.
Includes support for nested testsets, enabling the parents and children of matching testsets.
Alternative to #33672
The way it does this is by:
Pkg.testfirst running the discovery phase of testsets and their structure, which is based on JuliaSyntax to avoid running test code at that stagePkg part JuliaLang/Pkg.jl#4379
i.e. testing this testset https://github.com/JuliaLang/Pkg.jl/blob/482399a51bc8bea0c58cb8722fd7ddf7637aff77/test/misc.jl#L12
or could have used a regex match
Developed with Claude.