Skip to content

Include space for {with,local}_mocked_bindings() placeholders in $package-package.R? #1902

@MichaelChirico

Description

@MichaelChirico

{testthat} 3.2.0 includes a new evolution for mocking in tests: with_mocked_bindings() and local_mocked_bindings().

One aspect of this is we're encouraged to add placeholders for {base}-mocked functions in our package namespace:

To mock a function in the base package, you need to make sure that you have a binding for this function in your package. It's easiest to do this by binding the value to NULL.

As a package grows/the number of base functions to mock becomes scattered throughout the package, confusion may ensue. This reminds me of how use_package_doc() allots space in the template file for all the #' @import / #' @importFrom tags to live:

## usethis namespace: start
## usethis namespace: end

Should use_package_doc() now also set aside some space for mocked binding {base} placeholders as well?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions