You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deftest_frozen_things():
# Hypothesis reraises the TypeError as a StopTest, because the data is Frozen.@given(st.data())deffoo(data):
data.conjecture_data.freeze()
raiseTypeError("oops")
foo()
It should be possible to repro without manually freezing the data as well, especially if invoking async stuff.
# This can happen if an error occurred in a finally
# block somewhere, suppressing our original StopTest.
# We raise a new one here to resume normal operation.
raiseStopTest(data.testcounter) frome
Possible fixes:
reraise the exception saved in StopTest.__cause__ when the StopTest is handled. I'm getting ~8 hits for except StopTest in non-test code though, so could get messy.
might be better to save the exception in the DataObject
Traverse e.__context__ to see if we actually did raise Stoptest before handling. Although this would still suppress user errors in teardown if we did raise Stoptest, so it's only a partial fix. (edit: except the test_error_is_in_finally test works.. so maybe this would fix it???)
Git blame shows ac0d02a as adding the logic. Though I don't understand the code intimately enough to see what the difference between their added test, which ultimately reraises their ValueError, and mine is.
It should be possible to repro without manually freezing the data as well, especially if invoking async stuff.
Offending lines:
hypothesis/hypothesis-python/src/hypothesis/core.py
Lines 1077 to 1089 in 0991e76
Possible fixes:
StopTest.__cause__
when theStopTest
is handled. I'm getting ~8 hits forexcept StopTest
in non-test code though, so could get messy.DataObject
e.__context__
to see if we actually did raiseStoptest
before handling. Although this would still suppress user errors in teardown if we did raiseStoptest
, so it's only a partial fix. (edit: except thetest_error_is_in_finally
test works.. so maybe this would fix it???)Git blame shows ac0d02a as adding the logic. Though I don't understand the code intimately enough to see what the difference between their added test, which ultimately reraises their
ValueError
, and mine is.See discussion in #4110 (comment)
The text was updated successfully, but these errors were encountered: