Uh oh!
There was an error while loading. Please reload this page.
In process test - #2367
Conversation
kinnison
commented
Jun 7, 2020
In its current state, this PR blows my |
rbtcollins
commented
Jun 8, 2020
success! |
kinnison
left a comment
There was a problem hiding this comment.
Two minor niggles and then I think this is mergeable. What sort of test time improvement do we see?
Uh oh!
There was an error while loading. Please reload this page.
| let matches = match cli().get_matches_from_safe(process().args_os()) { | ||
| Ok(matches) => Ok(matches), | ||
| Err(e) | ||
| if e.kind == clap::ErrorKind::HelpDisplayed | ||
| || e.kind == clap::ErrorKind::VersionDisplayed => | ||
| { | ||
| return Ok(utils::ExitCode(0)) | ||
| } | ||
| Err(e) => Err(e), | ||
| }?; |
There was a problem hiding this comment.
It might be nice to have this factored into a function given it's also used in setup_mode.rs and someone fixing something in one might miss the other.
3083faf to
8ec378bCompareThe home crate also accesses global process state, so we need to abstract over it as well.
There's a certain amount of hackiness in making this work, because a number of our tests are intrinsically hostile to in-process testing, but generally speaking it works well.
The better to test with.
In-process tests have a tty and clap doesn't honour our process() abstraction; fortunately it does consult TERM, which is good enough.
kinnison
left a comment
There was a problem hiding this comment.
Okay, I guess you didn't think the refactor worthwhile, fair enough.
rbtcollins
commented
Jun 14, 2020
I think its marginal - there's really only one possible spelling here, and it's dictated by clap; and we have full test coverage. I'm happy to swing back and add it in when I get some more time. |
Run rustup tests in-process
Using the in-process test support feature, we can now change the test runner to run select CLI operations in-process.
More can be done, but this is the first major step: running rustup-mode in-process much of the time.