-
Notifications
You must be signed in to change notification settings - Fork 161
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
proptest! macro doesn't play nice with tokio::test #179
Comments
The root issue is that |
I would be interested in adding async support to the proptest macro, would it make sense to just add async versions of each case or have a separate proptest_async macro? I suppose it would be nice to be able to mix and match tests in the same usage. |
It would be great to have this! |
we'll be looking at async support holisitically in #442 |
Use the test_strategy::proptest macro for nice async support. Upstream proptest+tokio issue: proptest-rs/proptest#179 While there is a workaround there, the `prop_assert!` macro didn't seem to work properly. The `assert!` macro does work, but then we see all the output when proptest tries to shrink a failing example.
Use the test_strategy::proptest macro for nice async support. Upstream proptest+tokio issue: proptest-rs/proptest#179 While there is a workaround there, the `prop_assert!` macro didn't seem to work properly. The `assert!` macro does work, but then we see all the output when proptest tries to shrink a failing example.
Use the test_strategy::proptest macro for nice async support. Upstream proptest+tokio issue: proptest-rs/proptest#179 While there is a workaround there, the `prop_assert!` macro didn't seem to work properly. The `assert!` macro does work, but then we see all the output when proptest tries to shrink a failing example.
Use the test_strategy::proptest macro for nice async support. Upstream proptest+tokio issue: proptest-rs/proptest#179 While there is a workaround there, the `prop_assert!` macro didn't seem to work properly. The `assert!` macro does work, but then we see all the output when proptest tries to shrink a failing example.
* Add more property tests. Use the test_strategy::proptest macro for nice async support. Upstream proptest+tokio issue: proptest-rs/proptest#179 While there is a workaround there, the `prop_assert!` macro didn't seem to work properly. The `assert!` macro does work, but then we see all the output when proptest tries to shrink a failing example. * More unwraps to assert * Add some array tests * hypothesis style naming * fix comment * Better array metadata strategy * Use Arbitrary * rename * Add regression file * bump version * Option<DimensionNames> * More feedbaclk * Move strategies module under tests * Make test-strategy dev dep only * Revert "Make test-strategy dev dep only" This reverts commit 93f5ed5. * cleanup * Tweak one flatmap * Move strategies to new module * Align dimensionname type with spec * Check error types where we can * Implement fmt::Debug trait on Storage * update cargo.toml
Hi! This is purely an ergonomics thing.
I'm working on some async-heavy code and like to use the
tokio::test
macro:If I try to adapt it to the proptest context:
I get some inscrutable errors:
The following works around fine:
(Using the
proptest!
macro with a closure doesn't, because it doesn't handle async closures.)I think it'd be a little silly to special-case
proptest
for every test runner, but as I understand, the Tokiotest
macro pretty much just does my workaround.I think the
proptest!
macro is very similar. I wonder if we could make one of the following changes:proptest!
would go and expand its code first; the second test macro should pick up the rest. I don't totally get why this doesn't happen currently.#[proptest::test
] macro, which would basically do whatproptest!
does but to one test. The hitch is thattokio::test
wants (1) no arguments, so we'd have to put it after#[proptest::test]
, and (2) no extra#[test]
, which means we'd need#[proptest::test]
to (have an option to) not emit that. We could also maybe address this at the Tokio end.IIRC custom test runner stuff is pretty in-flux right now, so maybe it's premature to do anything. Or I could be missing something obvious.
If you like any of these ideas or something similar, I might be able to take a stab at implementing, though I'm a little shaky on macros.
The above code assumes the following preamble:
P.S. Thanks for your work on proptest; it's really helped me write high-assurance software and made testing fun to boot!
The text was updated successfully, but these errors were encountered: