Closed cderv closed 5 years ago
the last commit would be the cleaner way to assign and be sure to remove the object. This is a way to know our test are clean.
Nota: the rm()
was not working because teardown()
was executing code in another environment and rm
does not inherits by default. rm
would have worked but I find rlang env_*
function clearer.
this PR brings changes that are not strictly required so feel free to dismiss 😄
Do you think whether it is possible to write a single function embedding skip(), setup() and teardown()?
This is done now, and it is called setup_chrome_test()
, in 44f39181509254588831dc9bfa8030bde4255f36
This is a small improvement trying to use the mechanism from testthat.
setup
andteardown
are in testthat to execute code before each files and at the end of each files. likeon.exit
orreg.finalizer
. There is a mechanism for them to leave in their ownsetup-*
andteardown-*
files, executed before and after each test, but not run byload_all
, (whereas similarhelper-*
files are run withload_all
.Here, as all the test file does not require chrome, we can't use the files feature.
setup
is not really useful, because code is executed imediately, in a clean environment. We must assign to global env... so not sure it is useful. However,teardown
is a way for us to be sure to close connection by writing such code, just after we open, like aon.exit
call you write just under file creation to be sure the file is deleted at the end.I don't remove the object in teardown, because I believe each file is run in its own session but I am not sure... Removing with
rm
throws an error... Still investigating.What do you think ?
Yeah, I know... Small things but I like to test new features! 😄
This change is