-
-
Notifications
You must be signed in to change notification settings - Fork 142
Make the hypothesis plugin check laws from user-defined interfaces too
#2060
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 the hypothesis plugin check laws from user-defined interfaces too
#2060
Conversation
When running property tests for an container, we register it as the strategy for each ancestor interface with laws. However, we do that only for modules in `returns.`, which means that lawful interfaces written by users will not be resolved. This commit just demonstrates the current state.
Right now, it just gets all MRO classes, and it misses interfaces defined outside `returns`. Will tackle that in the next commit.
Earlier, we were restricting it to any class within `returns`. Main user-visible change: We now include `Lawful` ancestors outside `returns`.
We check that the interface class actually has laws. This should eliminate any false positives that come from patching interfaces that were defined outside `returns`. Added a `_ParentWrapper` to test that it doesn't show up. (It did before the change in this commit.) Add to CHANGELOG and the hypothesis plugins page.
sobolevn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just one minor suggestion.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2060 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 80 81 +1
Lines 2485 2576 +91
Branches 437 44 -393
==========================================
+ Hits 2485 2576 +91 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sobolevn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I have made things!
Thanks for the thoughtful and convenient plugin for running interface laws.
I found, however, that the plugin was not running the laws for an interface I defined myself. So, I decided to add that behavior.
Main changes:
returnsmodule. This is the user-visible change.hypothesisplugin, for each property test, we patch the interface with the container strategy:Checklist
CHANGELOG.mdRelated issues