Skip to content

random warning on unit test #186

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

Closed
tjmahr opened this issue May 2, 2019 · 3 comments
Closed

random warning on unit test #186

tjmahr opened this issue May 2, 2019 · 3 comments
Labels

Comments

@tjmahr
Copy link
Collaborator

tjmahr commented May 2, 2019

Sometimes I get the following warning when running tests

test-ppc-test-statistics.R:30: warning: ppc_stat returns ggplot object
Computation failed in `stat_bin()`:
`binwidth` must be positive

The specific test is

  expect_gg(ppc_stat(y2, yrep2, stat = "prop0"))

But this doesn't happen every time. We need to bin down this nondeterminism.

@jgabry
Copy link
Member

jgabry commented May 2, 2019

I haven't seen that before, but my first guess is that this is because the seed for generating the data is set on line 9 instead of line 1:

y2 <- rpois(30, 1)
yrep2 <- matrix(rpois(30, 1), ncol = 30)
group2 <- rep(1, 30)
set.seed(11172017)
vdiff_y <- rnorm(100)
vdiff_yrep <- matrix(rnorm(2500), ncol = 100)
vdiff_group <- gl(4, 25, labels = LETTERS[1:4])

(Same issue with the script generating the data for the MCMC plot tests. )

I can't be sure this is the problem because I haven't seen that error, but either way we should probably be setting the seed before simulating data for the tests. I thought we were, but I guess not. Sorry about that.

@jgabry jgabry added the tests label May 2, 2019
@jgabry
Copy link
Member

jgabry commented May 3, 2019

Alternatively, we could save the data for these tests in an rds or rda file and just load it in.

@jgabry
Copy link
Member

jgabry commented May 9, 2019

Ok so this is related to tidyverse/ggplot2#3043 and is fixed by tidyverse/ggplot2#3047. In d5bd1a8 I've also added a seed when we generate data for the tests.

I think it's safe to close this now.

@jgabry jgabry closed this as completed May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants