Function Mocking for Unit Testing in R

With the deprecation of mocking capabilities shipped with 'testthat' as of 'edition 3' it is left to third-party packages to replace this functionality, which in some test-scenarios is essential in order to run unit tests in limited environments (such as no Internet connection). Mocking in this setting means temporarily substituting a function with a stub that acts in some sense like the original function (for example by serving a HTTP response that has been cached as a file). The only exported function 'with_mock()' is modeled after the eponymous 'testthat' function with the intention of providing a drop-in replacement.


News

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("mockthat")

0.2.6 by Nicolas Bennett, 7 months ago


https://nbenn.github.io/mockthat/


Report a bug at https://github.com/nbenn/mockthat/issues


Browse source code at https://github.com/cran/mockthat


Authors: Nicolas Bennett [aut, cre]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports utils

Suggests testthat, pkgload, curl, jsonlite, withr


Suggested by ricu.


See at CRAN