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

New tool to compare global state before and after each test #1816

Merged
merged 12 commits into from
Jun 6, 2023
Merged

Conversation

hadley
Copy link
Member

@hadley hadley commented Jun 5, 2023

Fixes #1674

@lionel- could you please take a look at the implementation?
@jennybc could you please look at the docs?

@hadley hadley requested review from jennybc and lionel- June 5, 2023 15:40
Copy link
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm very excited about this!

My main feedback documentation-wise is that it's not clear where testthat_state() should be defined. Below R/ or in a test helper file?

R/test-that.R Outdated Show resolved Hide resolved
R/test-that.R Outdated Show resolved Hide resolved
hadley and others added 3 commits June 5, 2023 13:50
Co-authored-by: Jennifer (Jenny) Bryan <jenny.f.bryan@gmail.com>
@kevinushey
Copy link
Collaborator

Does this implementation leave the door open in case someone wants to check state only in certain tests, or configure how state is checked on a test-by-test basis?

@hadley
Copy link
Member Author

hadley commented Jun 5, 2023

No, because I'm mostly imagining that people will only want to turn this on occasionally during debugging, just because it's a lot of work to run down all the false positives (as we've learned in renv).

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

R/test-that.R Outdated Show resolved Hide resolved
R/test-that.R Outdated Show resolved Hide resolved
@hadley hadley merged commit 358a340 into main Jun 6, 2023
12 checks passed
@hadley hadley deleted the test-state branch June 6, 2023 21:29
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.

Easy way to check test invariants
4 participants