cjvanlissa / worcs

Rstudio project template and convenience functions for the Workflow for Open Reproducible Code in Science (WORCS)
https://cjvanlissa.github.io/worcs/
GNU General Public License v3.0
80 stars 11 forks source link

remove side effects of tests #37

Open aaronpeikert opened 4 years ago

aaronpeikert commented 4 years ago

there are some side effects of the test

  1. my git name is changed constantly :facepalm: I admit its funny, but we should probably stop that.
  2. many files get created under the test/testhat/ dir
  3. the output of rmarkdown render obfuscates the check/test output
cjvanlissa commented 4 years ago

Your git name is changed?

aaronpeikert commented 4 years ago

Not only mine it seems (but also andreas and maybe even yours) are changed to yourname image It is either code in the examples or in the tests... Because I changed it already 4 times back... https://github.com/cjvanlissa/worcs/blob/0ffe84374adba3fb2558311a210565d3f72bf6f8/tests/testthat/test-export_project.R#L18-L19

cjvanlissa commented 4 years ago
  1. gert can retrieve a record of the user's git signature. I think we can set and re-set that before and after the test
  2. That's a bug. They should go to tempdir
  3. That's probably difficult to change; rmarkdown does that. If sink() doesn't work, I wouldn't know a solution
cjvanlissa commented 4 years ago
  1. and 3. are fixed.

For 1., I've created worcs:::get_credentials(), which can be used with git_credentials() to set either the user credentials or default credentials in tests. This way, the tests pass both locally and remotely, and they don't replace the git signature. For 3., the function testthat::capture_output() is used.

aaronpeikert commented 4 years ago

Wow. Great, shall I tackle 2.?

cjvanlissa commented 4 years ago

Yes, if you can? Because I cannot reproduce the problem

cjvanlissa commented 4 years ago

@aaronpeikert can you confirm that all tests are now clean?

aaronpeikert commented 4 years ago

image I still get a bunch of files in the test dir, while I would want to fix that someday, it is irrelevant for the new release.

aaronpeikert commented 4 years ago

But my git setup remained unchanged.