Comments (5)
See test.common.utils.fails_with
; I'm also adding a similar decorator for "this test is for a deprecated thing" as part of #599.
from hypothesis.
I think this issue was actually about making fails part of the public API, but I don't think this was ever a good idea and people should be using pytest's xfail or equivalent for it really (maybe we should too)
from hypothesis.
Ah, right. I agree that it's a separate concern to the rest of the Hypothesis API, and users should look to their test runner of choice. Probably still useful for us to have a runner-agnostic fails_with though.
from hypothesis.
Yup. It's perfectly sensible to have extra decorators like this internally and/or in the test helpers, just not part of the public API. Past-@DRMacIver had some odd ideas about API design which I've had to unlearn the hard way. :-)
from hypothesis.
people should be using pytest's xfail or equivalent for it really (maybe we should too)
For posterity: @pytest.mark.xfail(raises=FooError)
is semantically different to @fails_with(FooError)
- the former indicates that raising FooError is expected behaviour due to an unfixed bug (and the test is reported as xfailed rather than passed), while the latter indicates that the test should raise FooError to pass.
Our internal decorator is instead more like a decorator form of with pytest.raises(FooError): ...
.
from hypothesis.
Related Issues (20)
- `hypothesis[django]`: CharField causes strange assertion issue
- `from_type` on `typing.Protocol` without methods HOT 1
- Hypothesis 6.91.0 makes pytest crashing HOT 2
- Add `alphabet=` argument to `from_lark()` strategy
- Warn if strategies depend on the `random` module without using `st.random_module()` HOT 3
- how to filter invalid result from the target efficiently? HOT 5
- `TypeError` when drawing from a strategy that produces `dataclasses` with a `defaultdict` attribute HOT 2
- how to make hypothesis stateful test to run enough steps in one example? HOT 1
- Warn when passing *strategies* as elements to `sampled_from` (rather than to `one_of`)?
- Add the ability to opt out of (into?) coverage reporting when collecting observability data HOT 3
- Hypothesis error reporting triggering internal error in inspect module
- Function name is reported as `_bootstrap_fixtures_and_run_test` in verbose reporting HOT 2
- how to shrink effectively with hypothesis stateful testing? HOT 1
- Consider splitting observability report status for `Status.OVERRUN` and `Status.INVALID` HOT 10
- 6.91.2: flaky `tests/quality/test_discovery_ability.py::test_can_produce_multi_line_strings` HOT 3
- Observability output does not conform to json spec HOT 2
- Folder ".hypothesis" appears after "pytest" run but I don't use hypothesis HOT 15
- InvalidArgument when using @given with a function with positional-only args HOT 2
- More clear behavior when passing non-strings to `note` HOT 1
- A big list of observability ideas
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hypothesis.