-
Notifications
You must be signed in to change notification settings - Fork 335
Improve desc_filter so you can select deeply nested tests #2077
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
Conversation
4af569a
to
84dc618
Compare
The error on Ubuntu is not related to my change and has been observed in other PRs too, e.g. #2061:
|
@hadley could you have a look? This PR is ready for review. |
@kubajal I'll take a look when I'm next working on testthat. |
I'm not sure that this makes sense to me, given that there's often code run outside of |
Perhaps my description was misleading. With my changes, any code outside of it(...) statement does get executed. It's just that the only it(...) statement that does get executed is the one with the provided desc argument. Here are my 3 arguments to merge it:
|
@hadley could you please revisit this PR and the comment above? |
In that case, I'd suggest:
|
Thanks, will fix that. |
26cdea5
to
f2ea828
Compare
f2ea828
to
c04eb3d
Compare
it
test from describe
)
@hadley the PR is ready for a new review. I also updated the title and description of the PR so it is more precise. |
Ok, I've reimplemented it in a way that's more easy for me to understand and refined all the tests. @jennybc can you please take a look? This shouldn't change any existing behaviour but should enable recursive selection of tests inside other tests. |
Fixes #2118 |
Currently,
desc_filter
let's you:test_that
or a singledescribe
expressions and not anit
expressiontest_that
anddescribe
expressionsThis PR expands
desc_filter
capabilities by adding support for:it
expressionsdescribe
expressions (and not only top-level) as per https://testthat.r-lib.org/reference/describe.htmlThis is implemented by making
desc_filter
accept list of test labels that act as selectors in the test hierarchy.So e.g. running
testthat::test_file("tests.R", desc=c("level 0, "level 1 A", "level 2 B"))
effectively triggers just
This gives more room for good IDE integrations, e.g. fixing meakbiyik/vscode-r-test-adapter#24.
This PR is a continuation of #1904 and #1840.