Skip to content

Commit

Permalink
MAINT: Fix nose features to work on pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
xoviat committed Dec 22, 2017
1 parent edb501d commit 59b0739
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# data, etc files to distribution. Avoid using MANIFEST.in for that.
#
include MANIFEST.in
include pytest.ini
include *.txt
include site.cfg.example
include numpy/random/mtrand/generate_mtrand_c.py
Expand Down
21 changes: 21 additions & 0 deletions numpy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import warnings
import pytest
import numpy

from numpy.core.multiarray_tests import get_fpu_mode

Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions numpy/ma/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6937,6 +6937,7 @@ def transpose(a, axes=None):
[[False False]
[False True]],
fill_value = 999999)
>>> ma.transpose(x)
masked_array(data =
[[0 2]
Expand Down

0 comments on commit 59b0739

Please sign in to comment.