summaryrefslogtreecommitdiff
path: root/numpy/_pytesttester.py
diff options
context:
space:
mode:
authorZac-HD <zac.hatfield.dodds@gmail.com>2020-07-16 14:54:36 +1000
committerZac-HD <zac.hatfield.dodds@gmail.com>2020-07-23 14:23:40 +1000
commit3d74fab153420baa61dd8ccd284265393218f471 (patch)
treeb44ca132aa9d1319462935707bad10f865e3ba6f /numpy/_pytesttester.py
parenta39e3021b9304fb5a76542d444b7fec2dcff1374 (diff)
downloadnumpy-3d74fab153420baa61dd8ccd284265393218f471.tar.gz
Configure hypothesis for np.test()
Diffstat (limited to 'numpy/_pytesttester.py')
-rw-r--r--numpy/_pytesttester.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/numpy/_pytesttester.py b/numpy/_pytesttester.py
index 1c32367f3..f37f223fa 100644
--- a/numpy/_pytesttester.py
+++ b/numpy/_pytesttester.py
@@ -140,6 +140,9 @@ class PytestTester:
import pytest
import warnings
+ # Imported after pytest to enable assertion rewriting
+ import hypothesis
+
module = sys.modules[self.module_name]
module_path = os.path.abspath(module.__path__[0])
@@ -202,6 +205,14 @@ class PytestTester:
pytest_args += ["--pyargs"] + list(tests)
+ # This configuration is picked up by numpy.conftest, and ensures that
+ # running `np.test()` is deterministic and does not write any files.
+ # See https://hypothesis.readthedocs.io/en/latest/settings.html
+ hypothesis.settings.register_profile(
+ name="np.test() profile",
+ deadline=None, print_blob=True, database=None, derandomize=True,
+ suppress_health_check=hypothesis.HealthCheck.all(),
+ )
# run tests.
_show_numpy_info()