Skip to content

cargo doesn't include test = false tests in --tests or --all-targets #13828

@vojtechkral

Description

@vojtechkral

Problem

A test marked as test = false is supposed to not be run when invoking cargo test.

This works, however, not only is the test not run, it's not built or checked (when using cargo check) either, not even with --tests or --all-targets passed.

As a workaround, I'm currently using --tests \* instead of --tests to actually include all tests including test = false ones.

Steps

  1. Mark a test with test = false in Cargo.toml
  2. Run cargo check --tests
  3. The test is not checked.
  4. Run cargo check --test \*
  5. The test is checked.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.77.2 (e52e36006 2024-03-26)
release: 1.77.2
commit-hash: e52e360061cacbbeac79f7f1215a7a90b6f08442
commit-date: 2024-03-26
host: aarch64-apple-darwin
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.4.0 (sys:0.4.70+curl-8.5.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 14.4.1 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-cargo-targetsArea: selection and definition of targets (lib, bins, examples, tests, benches)C-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions