3 stable releases

1.0.2 Sep 11, 2023

#651 in Testing

Download history 145/week @ 2024-07-20 258/week @ 2024-07-27 137/week @ 2024-08-03 134/week @ 2024-08-10 141/week @ 2024-08-17 100/week @ 2024-08-24 92/week @ 2024-08-31 82/week @ 2024-09-07 50/week @ 2024-09-14 118/week @ 2024-09-21 167/week @ 2024-09-28 52/week @ 2024-10-05 91/week @ 2024-10-12 39/week @ 2024-10-19 58/week @ 2024-10-26 59/week @ 2024-11-02

251 downloads per month
Used in 2 crates

MIT/Apache

11KB
56 lines

build status docs.rs license is MIT or Apache 2.0

mark-flaky-tests

There're some tests that sometimes pass and sometimes fail. We call them "flaky".

This crate provides a macro attribute #[flaky] that allows you to mark all the flaky tests in your codebase. You then have two options:

  1. In default mode, #[flaky] will retry a test for a few times and pass it if at least one run has passed.
  2. In strict mode, #[flaky] will still run test for a few times, but will only pass it if every run has passed.

To enable strict mode, set the environment variable MARK_FLAKY_TESTS_STRICT=true.

To adjust the amount of times a test is retried, set the environment variable MARK_FLAKY_TESTS_RETRIES to the desired amount. Default is 3.

To use #[flaky] with #[tokio::test], enable the tokio feature.

Tests that return ExitCode are currently not supported due to std API limitations.

Dependencies

~2.2–3MB
~59K SLoC