Skip to content
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

Option to negate tags in runtests #161

Closed
deltamarnix opened this issue Jul 10, 2024 · 2 comments
Closed

Option to negate tags in runtests #161

deltamarnix opened this issue Jul 10, 2024 · 2 comments
Labels
speculative a feature idea that we are undecided about wontfix This will not be worked on

Comments

@deltamarnix
Copy link

Would it be possible to write a negation when supplying tags to runtests()?

For example, I have a @testitem "do_a_lot" tags=["long"], and I only want to run all the tests that are not tagged long.
It would be great if I could specify runtests(tags=["!long"]), or runtests(exclude_tags=["long"]).

I'm referring to this part in the documentation: https://docs.juliahub.com/General/ReTestItems/stable/autodocs/#ReTestItems.runtests

@deltamarnix
Copy link
Author

As a workaround I have now used prefixes in the name of the test instead: @testitem "long_do_a_lot", and used a Regex: runtests(name=r"^(?!long_).*")

@nickrobinson251
Copy link
Collaborator

Hi, thanks for the suggestion. You can do this by passing a filter function as the first argument to runtests e.g.

not_long(testitem) = !in(:long, testitem.tags)
runtests(not_long)

or equivalently

runtests(ti -> !(:long in ti.tags))

i think we decided not to support a way to negate tags, since at that point the log of name, tags and (a hypothetical) exclude_tags gets quite complex, and you're better of just writing the logic in Julia, hence supporting the option to pass a function that filters on the name and tags directly.

Does that help?

@nickrobinson251 nickrobinson251 added the speculative a feature idea that we are undecided about label Aug 5, 2024
@nickrobinson251 nickrobinson251 added the wontfix This will not be worked on label Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
speculative a feature idea that we are undecided about wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants