-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
tests: Migrate alt_registry to snapbox #14031
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for you making this come true!!!
Yes, this puts us in an intermediate state which isn't ideal but much better than one person trying to do all of this in a single branch / PR.
Are you going to work this out by yourself? I believe these could be good issues for contributors.
@@ -642,6 +647,7 @@ impl Execs { | |||
/// See [`compare`] for supported patterns. | |||
/// | |||
/// See note on [`Self::with_stderr_does_not_contain`]. | |||
#[deprecated] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the replacement of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I realized it after reading changes in alt_regsitry. This is deprecated because we're going to assert the entire output instead of a subset of the output. Is it the plan in your mind? There are some tests asserting against rustc output. How should we deal with that?
(Not a blocker of this PR)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #14031 (comment)
☔ The latest upstream changes (presumably #13995) made this pull request unmergeable. Please resolve the merge conflicts. |
While this is noisy and hides other deprecations, I figured deprecations would make it easier for people to discover what tasks remain and allow us to divide and conquer this work rather than doing a heroic PR. In theory, this will be short lived and we'll go back to seeing deprecations in our tests.
Not at all, I plan to make this available for anyone to contribute. In fact, Scott has already started... Potential porting instructions1. Select a file to portThe files should have $ git pull --rebase
$ rg '#!.allow.deprecated' tests/testsuite Please check the comments on this issue for anyone to have claimed the file and then post that you claim the file 2. Remove
|
cda6b87
to
e589ed7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thanks a lot.
@bors r+ |
☀️ Test successful - checks-actions |
Update cargo 14 commits in b1feb75d062444e2cee8b3d2aaa95309d65e9ccd..4dcbca118ab7f9ffac4728004c983754bc6a04ff 2024-06-07 20:16:17 +0000 to 2024-06-11 16:27:02 +0000 - Add local registry overlays (rust-lang/cargo#13926) - docs(change): Don't mention non-existent workspace.badges (rust-lang/cargo#14042) - test: migrate binary_name to snapbox (rust-lang/cargo#14041) - Bump to 0.82.0; update changelog (rust-lang/cargo#14040) - tests: Migrate alt_registry to snapbox (rust-lang/cargo#14031) - fix: proc-macro example from dep no longer affects feature resolution (rust-lang/cargo#13892) - chore: Bump cargo-util-schemas to 0.5 (rust-lang/cargo#14038) - chore(deps): update rust crate pulldown-cmark to 0.11.0 (rust-lang/cargo#14037) - fix: remove `__CARGO_GITOXIDE_DISABLE_LIST_FILES` env var (rust-lang/cargo#14036) - chore(deps): update rust crate itertools to 0.13.0 (rust-lang/cargo#13998) - fix(toml): remove `lib.plugin` key support and make it warning (rust-lang/cargo#13902) - chore(deps): update compatible (rust-lang/cargo#13995) - fix: using `--release/debug` and `--profile` together becomes an error (rust-lang/cargo#13971) - fix(toml): Convert warnings that `licence` and `readme` files do not exist into errors (rust-lang/cargo#13921) r? ghost
What does this PR try to resolve?
The overall goal is to enable the use of snapshot testing on as many cargo tests as possible to reduce the burden when having to touch a lot of tests. Towards that aim, this PR
cargo_test_support::Execs
alt_registry
tests over as an example (and to vet it)I've taken the approach of deprecating all other output assertions on
Execs
with#[allow(deprecated)]
in every test file. This let's us easily identity what files haven't been migrated, what in a file needs migration, and helps prevent a file from regressing. This should make it easier to do a gradual migration that (as many people as they want) can chip in. It comes at the cost of losing visibility into deprecated items we use. Hopefully we won't be in this intermediate state for too long.To reduce manual touch ups of snapshots, I've added some regex redactions. My main concern with the
FILE_SIZE
redaction was when we test for specific sizes. That shouldn't be a problem because we don't useExecs::with_stderr
to test those but we capture the output and have a custom asserter for it.How should we test and review this PR?
Yes, this puts us in an intermediate state which isn't ideal but much better than one person trying to do all of this in a single branch / PR.
The main risk is that we'll hit a snag with snapbox being able to support our needs. We got away with a lot because everything was custom, down to the diffing algorithm. This is why I at least started with
alt_registry
to get a feel for what problems we might have. There will likely be some we uncover. I'm fairly confident that we can resolve them in some way,Additional information
This is a continuation of the work done in #13980.