summaryrefslogtreecommitdiff
path: root/numpy/conftest.py
diff options
context:
space:
mode:
authorxoviat <xoviat@users.noreply.github.com>2017-12-22 11:57:34 -0600
committerxoviat <xoviat@users.noreply.github.com>2017-12-22 17:30:51 -0600
commit59b073928f1bd521a58b756ef4293135d8bd3e29 (patch)
treea4d44e890b8962099755a07ddf77cd43658c1670 /numpy/conftest.py
parentedb501db0ee21566de423ee571814bcf1111f2eb (diff)
downloadnumpy-59b073928f1bd521a58b756ef4293135d8bd3e29.tar.gz
MAINT: Fix nose features to work on pytest
Diffstat (limited to 'numpy/conftest.py')
-rw-r--r--numpy/conftest.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/numpy/conftest.py b/numpy/conftest.py
index ea4197049..d3db866a7 100644
--- a/numpy/conftest.py
+++ b/numpy/conftest.py
@@ -5,6 +5,7 @@ from __future__ import division, absolute_import, print_function
import warnings
import pytest
+import numpy
from numpy.core.multiarray_tests import get_fpu_mode
@@ -52,3 +53,23 @@ def check_fpu_mode(request):
raise AssertionError("FPU precision mode changed from {0:#x} to {1:#x}"
" when collecting the test".format(old_mode,
new_mode))
+
+
+def pytest_addoption(parser):
+ parser.addoption("--runslow", action="store_true",
+ default=False, help="run slow tests")
+
+
+def pytest_collection_modifyitems(config, items):
+ if config.getoption("--runslow"):
+ # --runslow given in cli: do not skip slow tests
+ return
+ skip_slow = pytest.mark.skip(reason="need --runslow option to run")
+ for item in items:
+ if "slow" in item.keywords:
+ item.add_marker(skip_slow)
+
+
+@pytest.fixture(autouse=True)
+def add_np(doctest_namespace):
+ doctest_namespace['np'] = numpy