diff options
Diffstat (limited to 'numpy/conftest.py')
-rw-r--r-- | numpy/conftest.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/numpy/conftest.py b/numpy/conftest.py index 18d5d1ce9..1d3e0349f 100644 --- a/numpy/conftest.py +++ b/numpy/conftest.py @@ -1,8 +1,9 @@ """ Pytest configuration and fixtures for the Numpy test suite. """ -from __future__ import division, absolute_import, print_function +import os +import hypothesis import pytest import numpy @@ -12,6 +13,12 @@ from numpy.core._multiarray_tests import get_fpu_mode _old_fpu_mode = None _collect_results = {} +# See https://hypothesis.readthedocs.io/en/latest/settings.html +hypothesis.settings.register_profile( + name="numpy-profile", deadline=None, print_blob=True, +) +hypothesis.settings.load_profile("numpy-profile") + def pytest_configure(config): config.addinivalue_line("markers", @@ -22,6 +29,22 @@ def pytest_configure(config): "slow: Tests that are very slow.") +def pytest_addoption(parser): + parser.addoption("--available-memory", action="store", default=None, + help=("Set amount of memory available for running the " + "test suite. This can result to tests requiring " + "especially large amounts of memory to be skipped. " + "Equivalent to setting environment variable " + "NPY_AVAILABLE_MEM. Default: determined" + "automatically.")) + + +def pytest_sessionstart(session): + available_mem = session.config.getoption('available_memory') + if available_mem is not None: + os.environ['NPY_AVAILABLE_MEM'] = available_mem + + #FIXME when yield tests are gone. @pytest.hookimpl() def pytest_itemcollected(item): |