Skip to content
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

Use hypothesis to improve tests #562

Open
mattwthompson opened this issue Jul 11, 2019 · 6 comments
Open

Use hypothesis to improve tests #562

mattwthompson opened this issue Jul 11, 2019 · 6 comments
Labels

Comments

@mattwthompson
Copy link
Member

Describe the behavior you would like added to mBuild
While our unit tests have good coverage in terms of number of lines of source code and basic usages, there has been very little exploration of the boundaries of what this package can handle. Adding hypothesis to some tests could improve the behavior of mbuild and push us to better validate the inputs to functions

Describe the solution you'd like
https://hypothesis.readthedocs.io/en/latest/

Describe alternatives you've considered
Beating my head against the wall when adding a small change breaks something elsewhere

Additional context

@rmatsum836
Copy link
Contributor

I'm going to take a stab at this.

@rmatsum836
Copy link
Contributor

I think I understand the basics of how hypothesis works. But I think it's worth discussing in the next meeting specific functionalities of mBuild we would like to have covered by property testing.

@rmatsum836
Copy link
Contributor

Due to SciPy 2020, I'm taking another look at this. I think we can greatly improving our testing of reading/writing using hypothesis and hope to have a minimum working example in a PR sometime today.

@rmatsum836
Copy link
Contributor

Here are some simple example I worked on this morning: https://gist.github.com/rmatsum836/871c707e55ae985616b026087525fed9

Currently, I'm not sure hypothesis would integrate with pytest. This is my biggest question moving forward.

@vyasr
Copy link
Contributor

vyasr commented Jul 12, 2020

@rmatsum836 pytest works fine with hypothesis. If you want to see some examples, I use hypothesis extensively in the coxeter library I maintain. There are a couple of subtle gotchas to be aware of (for example, relating to whether fixtures can be reused in multiple hypothesis runs, see this issue for background if you're curious) but all of that can generally be worked around and the resulting tests are very helpful IMO.

@CalCraven
Copy link
Contributor

Guessing this never was able to be implemented. This is at the top of the wishlist though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants