Normalise the test suite conventions - #281
Merged
Merged
Conversation
Twenty files created temp files with bare `tempfile()` and never removed them.
The earth, glmnet, ranger and rpart test files had no installed-check for their own package, despite all four being in Suggests, so a machine missing one would see failures rather than skips. ranger's existing skip_on_os() calls are left alone: those guard platform numeric differences, not availability.
Sixty-one tests wrapped `tidypredict_test()` in `expect_snapshot()`, which turns a numeric regression into a snapshot diff rather than a failure. Assert on `$alert` instead, as CONTRIBUTING.md now asks. Snapshotting was also swallowing two warnings that the modelling packages raise for deliberately degenerate fits, in glm and rq. Both are now suppressed explicitly at the call site with a note, so the suite's warning count is unchanged rather than quietly higher.
Two spellings of the save and reload test, a third phrasing for the same thing in the GBM files, and a grammatical slip in ten copies of "formulas produces correct predictions". No snapshot keys moved: none of the renamed tests take snapshots, since the save and reload tests assert on predictions and the agreement tests were converted in the previous commit. "returns the right output" is left alone in all 27 places; it is uninformative rather than inconsistent, and giving each a meaningful name is a judgment call per test rather than a sweep.
They cover two model files and need a live cluster, so the name is deliberate rather than an oversight.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 item 3.8, the style sweep. Five mechanical commits, no production code touched.
The substantive one is the third: 61 tests wrapped
tidypredict_test()inexpect_snapshot(), which turns a numeric regression into a snapshot diff rather than a failure. They now assert on$alert, asCONTRIBUTING.mdasks. That also revealed two warnings the snapshots had been swallowing, from deliberately degenerate glm and rq fits; both are suppressed explicitly at the call site with a note, so the suite's warning count is unchanged rather than quietly higher.The rest:
withr::local_tempfile()in the 20 files that leaked temp files,skip_if_not_installed()in the four files that had no installed-check for their own suggested package, and the drifted test descriptions.Two things in the plan's list are deliberately not here:
round_print()sweep. It would rewrite snapshot content across 22 files, and the plan asks for every snapshot diff to be reviewed by hand rather than blanket-accepted. Twenty-two files of numeric churn cannot be meaningfully hand-verified, so the sweep would mean accepting on faith in exactly the place a real change could hide. The fragility it guards against is also still hypothetical: no snapshot has actually broken on precision.test-model-glm.R's two different ad hoc roundings fall under the same heading and are likewise untouched."returns the right output". Uninformative rather than inconsistent. Naming each one meaningfully is a judgment call per test, not a sweep.No snapshot keys moved, incidentally: none of the renamed tests take snapshots, because the save-and-reload tests assert on predictions and the agreement tests were converted in the preceding commit.
Suite is 1770 passing, unchanged, and
R CMD checkis clean.