Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expectations not wrapped in 'test_that()' call don't get reported #427

Closed
kevinushey opened this issue Mar 25, 2016 · 3 comments
Closed

expectations not wrapped in 'test_that()' call don't get reported #427

kevinushey opened this issue Mar 25, 2016 · 3 comments
Milestone

Comments

@kevinushey
Copy link
Collaborator

@kevinushey kevinushey commented Mar 25, 2016

Not sure if this is intended or not, but I noticed that with the current development version of testthat tests are not reported (e.g. with the little .) when not wrapped in test_that().

Is this a regression or intended behavior?


Repro:

cd $TMPDIR
rm -rf hellotestthat
R -e 'devtools::create("hellotestthat")'
cd hellotestthat
R -e 'devtools::use_testthat()'
echo -e 'context("Hello")\nexpect_true(TRUE)\n' > tests/testthat/test-hello.R
R -e 'devtools::test()'

With old testthat:

> devtools::test()
Loading hellotestthat
Loading required package: testthat
Testing hello
Hello : .

DONE

New testthat:

> devtools::test()
Loading hellotestthat
Loading required package: testthat
Testing hello
Hello:

DONE ===========================================================================
@hadley
Copy link
Member

@hadley hadley commented Mar 25, 2016

Definitely a regression :/

@kevinushey
Copy link
Collaborator Author

@kevinushey kevinushey commented Mar 28, 2016

It looks like the problem is that all of the reporter handling only gets registered in the test_code function (which is called by test_that):

https://github.com/hadley/testthat/blob/94fc45a2e9b92168d0f74328bcfaad66108daaaf/R/test-that.R#L76-L89

Does it make sense to move this registration code into e.g. test_file?

@krlmlr
Copy link
Member

@krlmlr krlmlr commented Mar 29, 2016

The current code makes sure that errors and skips do not propagate beyond the test_that() block. I guess we need a second, thinner withCallingHandlers() in test_file() (and probably elsewhere) if we want the dots in "bare" expectations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.