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

Thinking about how we test parsnip model registration with extension packages #186

Open
EmilHvitfeldt opened this issue Jan 24, 2024 · 0 comments
Labels
upkeep maintenance, infrastructure, and similar

Comments

@EmilHvitfeldt
Copy link
Member

This is related to #185. Which was darn hard to figure out.

What happens is that the .onload() of baguette will trigger in a test. Which is what we want. But it will stay triggered for any of the following tests. Such that we get different results sometimes depending on if we test all files or one file. Also, it violates some soft of test smell, since the order of tests matter

library(parsnip)
library(testthat)

parsnip::get_model_env()$bag_tree_args
#> # A tibble: 0 × 5
#> # ℹ 5 variables: engine <chr>, parsnip <chr>, original <chr>, func <list>,
#> #   has_submodel <lgl>

# could be in a previous file
test_that("load baguette", {
  library(baguette)
})
#> ── Skip: load baguette ─────────────────────────────────────────────────────────
#> Reason: empty test

parsnip::get_model_env()$bag_tree_args
#> # A tibble: 6 × 5
#>   engine parsnip         original func             has_submodel
#>   <chr>  <chr>           <chr>    <list>           <lgl>       
#> 1 rpart  class_cost      cost     <named list [2]> FALSE       
#> 2 rpart  tree_depth      maxdepth <named list [2]> FALSE       
#> 3 rpart  min_n           minsplit <named list [2]> FALSE       
#> 4 rpart  cost_complexity cp       <named list [2]> FALSE       
#> 5 C5.0   class_cost      cost     <named list [2]> FALSE       
#> 6 C5.0   min_n           minCases <named list [2]> FALSE
@EmilHvitfeldt EmilHvitfeldt added the upkeep maintenance, infrastructure, and similar label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upkeep maintenance, infrastructure, and similar
Projects
None yet
Development

No branches or pull requests

1 participant