Thank you so much for notifying this and explaining the details!
I was wondering why the tests on R-devel kept failing these days.
Let me add one more information for testthat users. Testthat
released "3rd edition" a while ago. If you turn on the edition,
expect_equal() will compare environments by default, and it
provides no option to ignore environments in general (as the
article below says, you can ignore environments if the object
is a formula or a function, but it's not always the case).
expect_equal() previously ignored the environments of
formulas and functions. This is most like to arise if you are
testing models. It’s worth thinking about what the correct
values should be, but if that is to annoying you can opt out
of the comparison with ignore_function_env or ignore_formula_env.
(https://testthat.r-lib.org/articles/third-edition.html)
As their blog post 1 says testthat's 2nd edition will never
go away, it's totally fine to choose check.environment=FALSE.
But, you might eventually want to migrate to 3rd edition in order
to use their new features. So, this might be a good chance for us
to reconsider if it really makes sense to compare the environments.
If not, maybe we can simplify the tests so that we'll be more ready
for the migration.
(Disclaimer: I'm not a developer of testthat and have almost no
experience of 3rd edition, so I might be wrong.)
The NEWS file in "R-devel" (the development version of R) now has
in 'NEW Features'
> • all.equal(f, g) for functions now by default also compares their
> environment(.)s, notably via new all.equal method for class
> function. Comparison of nls() fits, e.g., may now need
> all.equal(m1, m2, check.environment=FALSE).
and all your packages need at least one such
'check.environment=FALSE' in (at least one of) your
all.equal() calls --- or expect_equal(..) testthat calls.
See this R-devel (mailing list) thread on why we made the
change:
and please ask for help / questions on R-devel (the mailing
list), or possibly me, if necessary.
Note that I've investigated 'tvthemes' package in particular, as
its use of testthat ((as usual in such cases, because of all the
'testthat' tricks leading to obfuscation)) gave an error message
which was not at all directly pointing to the issue:
There, I've even opened a github issue with the solution (for
'tvthemes') here:
https://github.com/Ryo-N7/tvthemes/issues/15
The "gist" of it is to define a simple wrapper function
For R-devel (aka R 4.1.x), but also works in older R
Received 9 December 2020:
Hi,
Thank you so much for notifying this and explaining the details! I was wondering why the tests on R-devel kept failing these days.
Let me add one more information for testthat users. Testthat released "3rd edition" a while ago. If you turn on the edition, expect_equal() will compare environments by default, and it provides no option to ignore environments in general (as the article below says, you can ignore environments if the object is a formula or a function, but it's not always the case).
As their blog post 1 says testthat's 2nd edition will never go away, it's totally fine to choose check.environment=FALSE. But, you might eventually want to migrate to 3rd edition in order to use their new features. So, this might be a good chance for us to reconsider if it really makes sense to compare the environments. If not, maybe we can simplify the tests so that we'll be more ready for the migration.
(Disclaimer: I'm not a developer of testthat and have almost no experience of 3rd edition, so I might be wrong.)
Best, Yutani
2020年12月9日(水) 21:06 Martin Maechler maechler@stat.math.ethz.ch: