From 59b073928f1bd521a58b756ef4293135d8bd3e29 Mon Sep 17 00:00:00 2001 From: xoviat Date: Fri, 22 Dec 2017 11:57:34 -0600 Subject: MAINT: Fix nose features to work on pytest --- numpy/conftest.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'numpy/conftest.py') 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 -- cgit v1.2.1