tidyfun / tf

S3 classes and methods for tidy functional data
https://tidyfun.github.io/tf/
GNU Affero General Public License v3.0
5 stars 2 forks source link

Consider removing top-level code in test files #52

Open m-muecke opened 9 months ago

m-muecke commented 9 months ago

https://r-pkgs.org/testing-design.html#self-sufficient-tests

fabian-s commented 8 months ago

you mean stuff like this:

https://github.com/tidyfun/tf/blob/d4e5d6575478590f5b498e2a0ad682834e5599ce/tests/testthat/test-calculus.R#L1-L21 ?

i kind of see the point of "hermetic tests" during development where i maybe want to quickly run only specific tests and it's annoying if i need to run additional code outside the test to do so every time.

i don't see the point in test files that always run automatically top-to-bottom during CI runs / R CMD check anyway and would prefer to avoid copy-paste redundancy to move this inside of every testthat statement....

i also don't see how to replace these definitions of tfd objects and helper functions with calls to one-line "fixture" constructors like what they recommend in the book (https://r-pkgs.org/testing-advanced.html#test-fixtures), seems to add a lot of complexity for what seems -- to me -- like very little gain.....

am i missing something?