-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
enable regex-filtering of testsets based on their descriptions #33672
base: master
Are you sure you want to change the base?
Conversation
How about each testset gets assigned a hierarchically defined label? Ie the above would be |
Interesting idea! it would allow to get away with the ugly "JULIA_TESTSET_DEPTHS". With the current state of Julia's own tests infrastructure, it wouldn't work as if no testsets are run in a file, then it errors. But I guess this could be fixed. |
So the hierarchical approach makes it easy to filter for level one, e.g. using |
Going down the rabbit hole: one solution may be to use PCRE's "partial matching" capabilities. If a testset's current description matches the regex |
I'm not sure if regexpes are the way to go here. Eg JuliaLang/Pkg.jl#1226 instead uses a list of tests to run, we could just do that without regexp? It seems to me that the common use case for the feature is "ok I changed that part of the code, I just need to run the corresponding test", for which passing a list of tests (in hierarchical format, but not regexp) would be the most user-friendly option. The good thing with regexp is that you can easily exclude specific tests ("I know that one will break, but are the others ok?"), but I would imagine that's less common? (Also I don't know for others, but I rarely use regexps, and every time I do it's in a different program and I have to look up the syntax over again, which is always annoying) |
|
I hope it's ok to leave a drive-by comment. I am still inexperienced with Julia as today was the first time I've created some code and run it. I come from Python, and in my opinion, the pytest test framework has done most (all?) things right and is powerful and a pleasure to use. I think you can't go wrong in taking design inspiration from pytest. |
Currently this PR uses the Perhaps it could instead use |
this will be a supercool feature. any plans to move it forward? thanks |
I'm happy to move it forward if there is support, maybe it needs the triage label. In the meantime, at least two packages implemented filtering of testsets: https://github.com/RelationalAI-oss/XUnit.jl and https://github.com/JuliaTesting/ReTest.jl. For |
This would be very nice to have. Any updates? |
I much prefer the programmatic interface to this like ReTest has over environment variables. That would also make it easier to do fancy things like specify multi-component paths to match, e.g. |
Any updates on this topic? Currently we run our tests via |
The current solutions (that I know of) to run only a certain subset (typically of size one) of testsets in a project, consist either to comment out portions of the test files, or to copy-paste the testset at the REPL (which often doesn't work seamlessly, as you have to replicate the state in the REPL, e.g. define global variables, functions (like
replshow()
in Julia's "test/show.jl" file) etc.This is not ideal, and filtering run testsets based on their description would go a long way to simplify this process, in many cases at least.
This PR uses a
"JULIA_TESTSET_REGEX"
environment variable: if set, only testsets matching this regex are run (note that this can be used to exclude certain patterns, with "negative lookahead" regexes). Usually, only toplevel testsets should be filtered, otherwise, filtering in only the following tests for example would be complicated:There is a catch: in the Julia repo for example, tests in a file are implicitly wrapped in a testset. So in this case, you only want the filtering to happen for testsets at nesting level 2 (toplevel is 1). So there is an other environment variable which contains a comma-separated list of levels (depths) at which filtering must happen,
"JULIA_TESTSET_DEPTHS"
, defaulting to "1".(The name
"JULIA_TESTSET_DEPTHS"
is far from ideal, suggestions welcome).