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

Various fixes to interactive test running #51

Merged
merged 6 commits into from
Nov 23, 2020
Merged

Conversation

nealrichardson
Copy link
Owner

@nealrichardson nealrichardson commented Nov 23, 2020

Fixes #47. You can now run tests interactively with devtools::test().

The issues were:

  • public() doesn't really work when you've loaded the package with pkgload::load_all() because everything is put in the global environment, so we can't test that it catches when you try to call unexported functions. One skip added.
  • There was a gap in the logic for the scenario where you explicitly set a redactor function but pkgload is also loaded (as a special case so that you can develop a redactor for your package interactively). This is fine when running the tests without devtools, but when you do, pkgload is on the search path so the logic was wrong (and you can't detach pkgload as one of the teardowns tried.)
  • Some tests were altering global state and not cleaning up, so once I got the first run of devtools::test() to pass, a second run in the same R process would fail.

I've also added a GitHub Actions job that runs the tests with devtools::test() (twice, in fact) so that we don't regress on this.

cc @maelle @jonkeane

@codecov-io
Copy link

codecov-io commented Nov 23, 2020

Codecov Report

Merging #51 (0c2e7db) into master (96e9ea6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #51   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           17        17           
  Lines          435       445   +10     
=========================================
+ Hits           435       445   +10     
Impacted Files Coverage Δ
R/find-redactor.R 100.00% <100.00%> (ø)
R/find-requester.R 100.00% <100.00%> (ø)
R/vignette.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 96e9ea6...0c2e7db. Read the comment docs.

@nealrichardson nealrichardson merged commit be6d80f into master Nov 23, 2020
@nealrichardson nealrichardson deleted the interactive branch November 23, 2020 23:24
@maelle
Copy link
Contributor

maelle commented Nov 25, 2020

Awesome! Any wisdom to add to hadley/r-pkgs#483? 🙂

nealrichardson added a commit that referenced this pull request Dec 21, 2020
* Various fixes to interactive test running

* Update docs

* Try to test devtools::test on GHA

* Fail the build if devtools::test fails

* Better detection of load_all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failures when running the tests interactively
3 participants