mockery::stub is creating mocking functions that persist into other tests

Hmmm, can you unpack a bit more what you mean about defining a wrapper function that you can mock? Like, wrapping the function you want to mock up in a function, say I had something like so:

is_windows <- function(){
  .Platform$OS.type == "windows"
}

check_stuff <- function(){
   if (is_windows()) stop("doesn't work on windows, sorry")
}
1 Like