-
Notifications
You must be signed in to change notification settings - Fork 24
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
Capture output using snapshots #198
Conversation
Also, I noticed you source a file in your tests pknca/tests/testthat/test-dplyr.R Line 1 in 46a7091
If you just name the file with a |
Thanks for the PR! I do want to keep those tests because I want to confirm that the join occurs based on the expected columns. While I know that others don't prefer the practice, I do test for message, warning, and error text because I want to ensure that the actual cause of the condition is the one I'm expecting and not an unexpected condition. I'll take a look at the new dplyr behavior and see how I can test better without using the text itself. For the pointer to use the |
Just use the snapshot tests I gave you then |
We reverted the idea of removing helper files since we find them pretty helpful still r-lib/testthat#1626 |
@DavisVaughan, I'd prefer to do a stronger test than the snapshot test. The reason for this is because some of my message tests have caught bugs introduced in other packages. I'll make the testing more dynamic to the version of dplyr by capturing the expected message from a well-controlled join. Do you think a PR to dplyr would be accepted to add a class and the by information to the Classing the message and adding the information seems like it would be the most robust. |
We do not have any plans to add more information to that message because we do not believe developers should be relying on its output like that, no. I strongly suggest that you just use a snapshot test. It is by far the most robust and lowest pain way (for both you and us) to check that the output is what you expect it to be while also never failing on CRAN. |
@DavisVaughan, I fixed it a different way in #199 (by capturing the expected message from a known-good join and using that). I tested my update with both the CRAN and development versions of dplyr. I will release to CRAN likely later tonight. |
Actually, I just remembered that I wanted to have #197 fixed soon, so it won't be tonight, but I will have it before the dplyr submission to CRAN. |
This PR makes your package compatible with the next version of dplyr:
You were explicitly testing the message that
left_join()
returns when it tells you the common variables it joins by. We highly discourage this, because you don't own that message, and in fact we have changed it in the next version of dplyr. If you must do this, use a snapshot test so that it won't break on CRAN if we do change it. That is what I've done here (captured with CRAN dplyr), but I'd encourage you to just remove these tests altogether if you really don't care about them.We plan to submit dplyr 1.1.0 on January 27th.
This should be compatible with both dev and CRAN dplyr. It would help us out if you could go ahead and send a patch version of your package to CRAN ahead of time! Thanks!