fix(test): Expose '--no-capture' in favor of --nocapture by epage · Pull Request #139224 · rust-lang/rust (original) (raw)

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

epage

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-libs

Relevant to the library team, which will review and decide on the PR/issue.

labels

Apr 1, 2025

epage

Comment on lines +202 to +204

@epage epage added A-libtest

Area: `#[test]` / the `test` library

T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.

labels

Apr 1, 2025

Noratrieb

@rustbot rustbot added A-compiletest

Area: The compiletest test runner

A-testsuite

Area: The testsuite used to check the correctness of rustc

T-bootstrap

Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

labels

Apr 10, 2025

@epage epage changed the titlefix(test): Expose '--no-capture', deprecating '--nocapture' fix(test): Expose '--no-capture' in favor of --nocapture

Apr 10, 2025

jieyouxu

@epage epage added I-libs-api-nominated

Nominated for discussion during a libs-api team meeting.

and removed T-bootstrap

Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

labels

Apr 14, 2025

@epage

This will help with hiding some options in --help

@epage

This improves consistency with commonly expected CLI conventions, avoiding a common stutter people make when running tests (trying what they expect and then having to check the docs to then user whats accepted).

An alternative could have been to take a value, like --capture <value> (e.g. pytest does this). Overall, we're shifting focus for features to custom test harnesses (see rust-lang#134283). Most of pytests modes will likely be irrelevant in that situation. As for the rest, its too early to tell which, if any, may be relevant, so we're sticking with this small, quality of life improvement.

By deprecating --nocapture, we intend that custom test harnesses do not need to support it for reasons outside of their own compatibility requirements, much like the deprecation in rust-lang#134283

I'm punting for now on the naming of RUST_TEST_NOCAPTURE. I feel like T-testing-devex should do a wider look at environment variables role in libtest before evaluating whether to

Other CLI flags were evaluated for casing consistency:

Fixes rust-lang#133073

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Apr 27, 2025

ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request

Apr 28, 2025

@ChrisDenton

fix(test): Expose '--no-capture' in favor of --nocapture

This improves consistency with commonly expected CLI conventions, avoiding a common stutter people make when running tests (trying what they expect and then having to check the docs to then user whats accepted).

An alternative could have been to take a value, like --capture <value> (e.g. pytest does this). Overall, we're shifting focus for features to custom test harnesses (see rust-lang#134283). Most of pytests modes will likely be irrelevant in that situation. As for the rest, its too early to tell which, if any, may be relevant, so we're sticking with this small, quality of life improvement.

I expect we'll warn about --nocapture being deprecated in the future after a sufficient transition period has been allowed. By deprecating --nocapture, we intend that custom test harnesses do not need to support it for reasons outside of their own compatibility requirements, much like the deprecation in rust-lang#134283

I'm punting for now on the naming of RUST_TEST_NOCAPTURE. I feel like T-testing-devex should do a wider look at environment variables role in libtest before evaluating whether to

Other CLI flags were evaluated for casing consistency:

Regarding the implementation, I moved --nocapture out of optgroups(), into parse_opts(), out of an abundance of caution in passing the options without a deprecated value to the usage generation. However, the usage does not actually show optional flags, so this could potentially be dropped, simplifying the PR.

Note: compiletest added --no-capture instead of --nocapture in rust-lang#134809

T-testing-devex FCP: rust-lang#133073 (comment)

Fixes rust-lang#133073

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025

@bors

ChrisDenton added a commit to ChrisDenton/rust that referenced this pull request

Apr 28, 2025

@ChrisDenton

fix(test): Expose '--no-capture' in favor of --nocapture

This improves consistency with commonly expected CLI conventions, avoiding a common stutter people make when running tests (trying what they expect and then having to check the docs to then user whats accepted).

An alternative could have been to take a value, like --capture <value> (e.g. pytest does this). Overall, we're shifting focus for features to custom test harnesses (see rust-lang#134283). Most of pytests modes will likely be irrelevant in that situation. As for the rest, its too early to tell which, if any, may be relevant, so we're sticking with this small, quality of life improvement.

I expect we'll warn about --nocapture being deprecated in the future after a sufficient transition period has been allowed. By deprecating --nocapture, we intend that custom test harnesses do not need to support it for reasons outside of their own compatibility requirements, much like the deprecation in rust-lang#134283

I'm punting for now on the naming of RUST_TEST_NOCAPTURE. I feel like T-testing-devex should do a wider look at environment variables role in libtest before evaluating whether to

Other CLI flags were evaluated for casing consistency:

Regarding the implementation, I moved --nocapture out of optgroups(), into parse_opts(), out of an abundance of caution in passing the options without a deprecated value to the usage generation. However, the usage does not actually show optional flags, so this could potentially be dropped, simplifying the PR.

Note: compiletest added --no-capture instead of --nocapture in rust-lang#134809

T-testing-devex FCP: rust-lang#133073 (comment)

Fixes rust-lang#133073

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025

@bors

bors added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025

@bors

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Apr 28, 2025

@rust-timer

Rollup merge of rust-lang#139224 - epage:nocapture, r=thomcc

fix(test): Expose '--no-capture' in favor of --nocapture

This improves consistency with commonly expected CLI conventions, avoiding a common stutter people make when running tests (trying what they expect and then having to check the docs to then user whats accepted).

An alternative could have been to take a value, like --capture <value> (e.g. pytest does this). Overall, we're shifting focus for features to custom test harnesses (see rust-lang#134283). Most of pytests modes will likely be irrelevant in that situation. As for the rest, its too early to tell which, if any, may be relevant, so we're sticking with this small, quality of life improvement.

I expect we'll warn about --nocapture being deprecated in the future after a sufficient transition period has been allowed. By deprecating --nocapture, we intend that custom test harnesses do not need to support it for reasons outside of their own compatibility requirements, much like the deprecation in rust-lang#134283

I'm punting for now on the naming of RUST_TEST_NOCAPTURE. I feel like T-testing-devex should do a wider look at environment variables role in libtest before evaluating whether to

Other CLI flags were evaluated for casing consistency:

Regarding the implementation, I moved --nocapture out of optgroups(), into parse_opts(), out of an abundance of caution in passing the options without a deprecated value to the usage generation. However, the usage does not actually show optional flags, so this could potentially be dropped, simplifying the PR.

Note: compiletest added --no-capture instead of --nocapture in rust-lang#134809

T-testing-devex FCP: rust-lang#133073 (comment)

Fixes rust-lang#133073

@epage epage deleted the nocapture branch

April 28, 2025 11:39