-
Notifications
You must be signed in to change notification settings - Fork 990
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
Add options= to test(), convert most Rraw scripts #5845
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5845 +/- ##
=======================================
Coverage 97.53% 97.53%
=======================================
Files 80 80
Lines 14915 14915
=======================================
Hits 14547 14547
Misses 368 368 ☔ View full report in Codecov by Sentry. |
Looking great! The only thing we might have to think about is where to put the |
yes, this is a new style. basically this is a "set up" step as it might be called in other unit testing frameworks. so I think it's important to have it up front for clarity. that doesn't have a parallel among current arguments. I might even put it before the test number, but definitely not after the test outcome parts. |
I also thought about the setup step, so 2nd place makes definitely sense. Pls, do not put it before the test number because in searching for tests I often use |
I would like to see a similar |
@tdhock I understand the use case, but if it is not as common as options, then I think it can be left to R's functions to set variables. Contrary R options are very common in tests, as Michael said, more than 200 times. |
I think it's perfectly reasonable, but let's save it for a follow-up issue to keep PRs sharp |
Here is a breakdown of the branches touching each test script as of now:
library(data.table)
tests = list.files(pattern = ".Rraw$", recursive = TRUE)
tests = setdiff(tests, "inst/tests/tests.Rraw")
branches_by_test = lapply(tests, function(test) {
system2("git", c("log", "--all", "--format=%S", "--", test), stdout=TRUE) |>
unique() |>
sort() |>
grep(pattern = "^refs/remotes/origin/", value=TRUE) |>
gsub(pattern = "^refs/remotes/origin/", replacement = "") |>
setdiff("test-options")
})
branch_link <- \(branch) paste0("[`", branch, "`](https://github.com/Rdatatable/data.table/tree/", branch, ")")
for (ii in seq_along(tests)) {
branches = branches_by_test[[ii]]
cat(sprintf(" - `%s`: %s\n", tests[ii], paste(branch_link(branches), collapse = " ")))
}
branch_data <- data.table(file = rep(tests, lengths(branches_by_test)), branch = unlist(branches_by_test)) |>
dcast(branch ~ basename(file), fun.aggregate = \(x) if (length(x)) "✅" else "", value.var = "branch")
branch_data[, branch := branch_link(branch)]
knitr::kable(branch_data) |
data.table spacing style document in Rd Add options= to test() document in Rd missed staged chunk convert most Rraw scripts to use test(options=) Merge branch 'master' into test-options Merge remote-tracking branch 'origin/test-options' into test-options
data.table spacing style document in Rd Add options= to test() document in Rd missed staged chunk convert most Rraw scripts to use test(options=) Merge branch 'master' into test-options Merge remote-tracking branch 'origin/test-options' into test-options
6ddb650
to
15d14c8
Compare
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @MichaelChirico and the rest of your teammates on Graphite |
This PR is waiting for other PRs to clear before we can merge. In particular here are the PRs to close/merge before we can merge each test file included here:
|
Closes #5842.
Didn't touch tests.Rraw yet as there are 200+ existing calls to
options()
. Better to save that for a future clean-up. Converted the other scripts with a more manageable diff to demonstrate the new usage.