'How to use @seed in hypothesis?

I'm trying to use @seed here: https://hypothesis.readthedocs.io/en/latest/reproducing.html#reproducing-a-test-run-with-seed

But when I include it before @given, I get the error NameError: name 'seed' is not defined at runtime.

My python script imports hypothesis. Should I be importing something else to get the @seed feature working?



Solution 1:[1]

As you note in a comment, you need to from hypothesis import seed before you can use @seed without qualification.

This is not specific to Hypothesis, it's just how imports work in Python generally :-)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zac Hatfield-Dodds