Skip to content

Instantly share code, notes, and snippets.

@jbn
Created June 24, 2018 16:20
Show Gist options
  • Save jbn/e97404bfc429592d2427f98163246c85 to your computer and use it in GitHub Desktop.
Save jbn/e97404bfc429592d2427f98163246c85 to your computer and use it in GitHub Desktop.
import numpy as np
def your_function(x):
return x * np.random.rand()
# Repeatedly calling this,
# pytest --caprng-global-np
# from the command line will fail with the same values
# over and over again until it passes.
def test_your_function():
# pytest --caprng-np
assert your_function(10) == 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment