Skip to content

libtest - capture stderr from tests #40298

Closed
@NoraCodes

Description

@NoraCodes

I'm currently having a problem with testing libraries that use log with either env_logger or flexi_logger in their tests. In the "real world", they should log to stderr, but libtest (and, by extension Cargo) doesn't capture stderr from tests, so I have to jump through hoops to get these libraries to log to stdout instead, or sift through huge logdumps.

Would it be possible to capture stderr from tests?

I originally posted this on the Cargo repo, but was told to file here. Possibly related to #31983, but I've tried limiting the test threads (RUST_TEST_THREADS=1) with no result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-libtestArea: `#[test]` / the `test` libraryC-feature-requestCategory: A feature request, i.e: not implemented / a PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions