-
Notifications
You must be signed in to change notification settings - Fork 586
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
Subtest failure not handled #1071
Comments
|
Unfortunately this is the expected behaviour - subtests clash very badly with Hypothesis, because a new subtest is added every time Hypothesis tries another example, and this "leaks" out of Hypothesis' control to the test runner. We will probably never support this as a feature, but I'll add an explicit warning about it to the docs - #1072. I'd also like to detect this and issue an explicit warning. While this seems similar to #991, the very nature of |
It's actually not too hard to support it. All we'd really need is a custom unittest subclass (which we could even install automatically, thought that might be a bit fraught) which adds some hooks and overrides so that Hypothesis clears the subtests at the beginning of each run and turns any subtests failing into a test failure. That being said, it's probably not going to get done any time soon unless someone is interested in picking up the work. Our unittest support is a bit basic in large part because I don't think any of us actually use unittest. |
|
Hmm. What about monkey-patching (update: nope; at the time of wrapping methods haven't been bound to classes) |
If a failure occurs within a subtest, Hypothesis doesn't seem to "catch" it.
Here's some example code:
test1fails and is correctly falsified (a single failure is printed, albeit with the full stack trace including Hypothesis's internal calls - I am unsure if this is intended, but it's irrelevant to this bug report).test2, using a subtest, fails 100 times (100 different values tested), each one printing the final call of the stack trace (i.e.self.assertTrue(False)without the internal calls). No falsifying example is printed, nor is any indicator of the value(s) used. (The identifier(name='subtest')is shown in the failure line, as expected.)I'm running Python 3.6.4 on Windows 10 Pro 64-bit, version 1709, build 16299.192.
Virtual Environment Packages (Django, Hypothesis, and dependencies):
The text was updated successfully, but these errors were encountered: