Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make runtime errors when someone forgets a direct failure persistence file #543

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sebas-zip
Copy link

@sebas-zip sebas-zip commented Jan 18, 2025

This gives the user a runtime error when they want the test to use a Direct failure persistence file. Here is a code example:

 proptest! {
#![proptest_config(Config {
            // set failure persistance
            failure_persistence: Some(
                Box::new(FileFailurePersistence::Direct("past_failures_that_I_want_to_test.txt"))
            ),
            ..Default::default()
        })]
        
  #[test]
  fn  test_that_should_run_old_failures()....

Will give the correct behavior of:

---- <crate>::tests::proptest_test_that_should_run_old_failures stdout ----
thread <crate>::tests::proptest_test_that_should_run_old_failures' panicked at proptest-1.6.0/src/test_runner/failure_persistence/file.rs:399:17:
FileFailurePersistence::Direct set, but file does not exist. Please provide:
past_failures_that_I_want_to_test.txt
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Without this change if the user moves that file- this unit test will not raise an error. The intent by writing that statement is run this past failures before trying new random inputs. There should be a hard error to tell the user that something has gone wrong.

@matthew-russo @cameron1024. This is my first time contributing so please let me know anything I can do to make this PR easier to review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant