You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Custom system of unit testing not always run created tests #230
Unit tests in some files were not attached correctly. This resulted in not running tests or at least not including the results in test coverage reports. One of the examples how it was fixed is in 36bc22e. This issue occurs in methods that are not actual functions defined as (see below) in hyperSpec:
I'll just put this here since I've not raised it before, but there is a package, roxut that allows one to write the unit tests in the body of the function definition, and simply captures those unit tests and writes them to the appropriate test file (works with testthat and tinytest). Inspired by @cbeleites approach but a simpler implementation. How do I know this? I authored it about a month ago.
Not suggesting hyperSpec series switch, just bringing it to everyone's attention. There is also, I found out after I completed my work, another package called roxytest which does the same thing and does a few other things that are nice additions to roxygen2.
there are still quite a lot of calls to setMethod() in hyperSpec that use anonymous functions.
in that case, test(method) <- function() {...} may attach the test to a generic which is not in the hyperSpec:: namespace.
the unit testing mechanism for attached tests (both as currently in hyperSpec and in hySpc.testtat) collects and runs only unit tests in namespace hyperSpec::.
Empty placeholder functions are IMHO misleading. But properly moving the functionality into a hidden internal function and attaching the test to that function both solves this issue and makes debugging easier (#238).
In some situations, R doesn't allow building the package is a test is attached to a wrong function (i.e., it is not possible to attach test to some random name. But the issue is when there is no error but the test still does not work as expected. A big number of skip messages even worsens the ability to identify discrepancies.
I do not think it is solved if tests can get attached to a wrong namespace without warning.
In some cases, there were warnings/errors that the test could not be attached to a function (and I liked that). But it is confusing that for some functions this is not the case.
I do not think this is solved in the sense I imagine it should be solved. Yet now it is more clear for me, how the tests should be attached to S4 methods.
Activity
bryanhanson commentedon Jul 26, 2020
I'll just put this here since I've not raised it before, but there is a package,
roxutthat allows one to write the unit tests in the body of the function definition, and simply captures those unit tests and writes them to the appropriate test file (works withtestthatandtinytest). Inspired by @cbeleites approach but a simpler implementation. How do I know this? I authored it about a month ago.Not suggesting
hyperSpecseries switch, just bringing it to everyone's attention. There is also, I found out after I completed my work, another package calledroxytestwhich does the same thing and does a few other things that are nice additions toroxygen2.cbeleites commentedon Jul 29, 2020
Here is what I think happens:
setMethod()in hyperSpec that use anonymous functions.test(method) <- function() {...}may attach the test to a generic which is not in thehyperSpec::namespace.hyperSpec::.Empty placeholder functions are IMHO misleading. But properly moving the functionality into a hidden internal function and attaching the test to that function both solves this issue and makes debugging easier (#238).
GegznaV commentedon Jul 29, 2020
Fixed in #225
In some situations, R doesn't allow building the package is a test is attached to a wrong function (i.e., it is not possible to attach test to some random name. But the issue is when there is no error but the test still does not work as expected. A big number of
skipmessages even worsens the ability to identify discrepancies.cbeleites commentedon Aug 28, 2020
@GegznaV is this solved by now? If so, please close. If not, please give further explanations. Thank you.
GegznaV commentedon Aug 31, 2020
I do not think it is solved if tests can get attached to a wrong namespace without warning.
In some cases, there were warnings/errors that the test could not be attached to a function (and I liked that). But it is confusing that for some functions this is not the case.
GegznaV commentedon Feb 16, 2021
I do not think this is solved in the sense I imagine it should be solved. Yet now it is more clear for me, how the tests should be attached to S4 methods.