{"action":"created","issue":{"url":"https://api.github.com/repos/hadley/testthat/issues/544","repository_url":"https://api.github.com/repos/hadley/testthat","labels_url":"https://api.github.com/repos/hadley/testthat/issues/544/labels{/name}","comments_url":"https://api.github.com/repos/hadley/testthat/issues/544/comments","events_url":"https://api.github.com/repos/hadley/testthat/issues/544/events","html_url":"https://github.com/hadley/testthat/issues/544","id":188841517,"number":544,"title":"Support to run test setup/cleanup?","user":{"login":"frankandrobot","id":787249,"avatar_url":"https://avatars.githubusercontent.com/u/787249?v=3","gravatar_id":"","url":"https://api.github.com/users/frankandrobot","html_url":"https://github.com/frankandrobot","followers_url":"https://api.github.com/users/frankandrobot/followers","following_url":"https://api.github.com/users/frankandrobot/following{/other_user}","gists_url":"https://api.github.com/users/frankandrobot/gists{/gist_id}","starred_url":"https://api.github.com/users/frankandrobot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frankandrobot/subscriptions","organizations_url":"https://api.github.com/users/frankandrobot/orgs","repos_url":"https://api.github.com/users/frankandrobot/repos","events_url":"https://api.github.com/users/frankandrobot/events{/privacy}","received_events_url":"https://api.github.com/users/frankandrobot/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-11T20:15:51Z","updated_at":"2016-11-11T20:39:52Z","closed_at":null,"body":"Is there a way to run a method before/after each `test_that` invocation? \r\n\r\nAlso, I'm new to R, if I need to share variables between tests can I just put them at the top of the test file? or will this pollute the global namespace?\r\n\r\n```R\r\ncontext(\"test\")\r\n\r\nsafeVar <- \"OK to put this here?\"\r\n\r\ntest_that(\"need safeVar 1\", { //... })\r\ntest_that(\"need safeVar 2\", { //... })\r\n```"},"comment":{"url":"https://api.github.com/repos/hadley/testthat/issues/comments/260050526","html_url":"https://github.com/hadley/testthat/issues/544#issuecomment-260050526","issue_url":"https://api.github.com/repos/hadley/testthat/issues/544","id":260050526,"user":{"login":"gaborcsardi","id":660288,"avatar_url":"https://avatars.githubusercontent.com/u/660288?v=3","gravatar_id":"","url":"https://api.github.com/users/gaborcsardi","html_url":"https://github.com/gaborcsardi","followers_url":"https://api.github.com/users/gaborcsardi/followers","following_url":"https://api.github.com/users/gaborcsardi/following{/other_user}","gists_url":"https://api.github.com/users/gaborcsardi/gists{/gist_id}","starred_url":"https://api.github.com/users/gaborcsardi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gaborcsardi/subscriptions","organizations_url":"https://api.github.com/users/gaborcsardi/orgs","repos_url":"https://api.github.com/users/gaborcsardi/repos","events_url":"https://api.github.com/users/gaborcsardi/events{/privacy}","received_events_url":"https://api.github.com/users/gaborcsardi/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T20:39:52Z","updated_at":"2016-11-11T20:39:52Z","body":"For 'setup', you can use helper functions, search for them in the docs. \r\n\r\nFor teardown AFAIK there is no really good solutions, but `on.exit()` seems to work for file-based teardown. See more here: #157, #158, #536 "}}
{"actor":{"display_login":"gaborcsardi"}}