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

Die Hard example uses outdated style of defining settings #3875

Closed
nchammas opened this issue Feb 8, 2024 · 2 comments · Fixed by #3888
Closed

Die Hard example uses outdated style of defining settings #3875

nchammas opened this issue Feb 8, 2024 · 2 comments · Fixed by #3888
Labels
docs documentation could *always* be better

Comments

@nchammas
Copy link
Contributor

nchammas commented Feb 8, 2024

This part of this article I wrote many years back (and which I am now referencing for my own benefit) no longer works:

with settings(max_examples=2000):
    DieHardTest = DieHardProblem.TestCase

On Hypothesis 6.92.9 this yields:

TypeError: 'settings' object does not support the context manager protocol

The correct style is now:

DieHardProblem.TestCase.settings = settings(max_examples=2000)
DieHardTest = DieHardProblem.TestCase

When I get a chance I will submit a patch. Just wanted to file this before I forgot.

It would also be good if the whole example were run as part of the CI build as a doctest to ensure the example never breaks silently again. But that's an idea for another day.

@nchammas
Copy link
Contributor Author

nchammas commented Feb 8, 2024

It would also be good if the whole example were run as part of the CI build as a doctest to ensure the example never breaks silently again. But that's an idea for another day.

Or not. Just saw #1822.

@Zac-HD Zac-HD added the docs documentation could *always* be better label Feb 8, 2024
@Zac-HD
Copy link
Member

Zac-HD commented Feb 8, 2024

Thanks for the report!

We'll probably want to fix #2943 in the process; the whole website build is a bit of a mess at the moment.

I'm also open to doing something with doctests; the problem before was that checking exact outputs changed too often and it was a pain to update. But maybe we can just check that doctests snippets do/don't raise an expected error, or build a tool to auto update the outputs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs documentation could *always* be better
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants