extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
196 stars 28 forks source link

Update tests, bump to testthat 3 #102

Closed malcolmbarrett closed 3 years ago

malcolmbarrett commented 3 years ago

This PR refactors the tests in several ways:

  1. Bump the testthat version to edition 3 and use parallel tests. This turned out to be easy, as none of the tests failed after 😎
  2. Use usethis.quiet introduced in #94 to quiet all tests prior to running (I bumped into noisy tests running them in certain ways) and reset options during teardown
  3. Adds withr and usethis to Suggests, which were already implicitly suggested via devtools.
  4. Uses withr to manage local states, e.g. temp files or options
  5. Uses withr and usethis to create local packages via local_package(). This is a self-cleaning test fixture.
  6. Adds direct tests for use_extendr()

I thought about more generally improving test coverage, but this seems reasonable for now and will let me finish #62 a bit more easily

Closes #98

clauswilke commented 3 years ago

Could you add some comments to your code? In particular, I think every function (including helper functions) should have a brief explanation of what it does and what its arguments are.

malcolmbarrett commented 3 years ago

Sure, I added some roxygen comments to the helper functions

Ilia-Kosenkov commented 3 years ago

Perhaps we should also add a note for developers about how to use snapshot testing in the future.

malcolmbarrett commented 3 years ago

@Ilia-Kosenkov Yeah, maybe a good thing to add to #95 (generally adding a testing section that mentions the functions implemented here + strategy)

clauswilke commented 3 years ago

@malcolmbarrett Is this ready to merge?

malcolmbarrett commented 3 years ago

Yes, unless there is anything else, it's ready on my end!

clauswilke commented 3 years ago

Thanks!