Skip to content

Commit

Permalink
ENH: do backward compatibility correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
xoviat committed Dec 22, 2017
1 parent 6cd348d commit 0f7a8b3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
11 changes: 11 additions & 0 deletions numpy/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import warnings
import pytest
import numpy
import importlib

from numpy.core.multiarray_tests import get_fpu_mode

Expand Down Expand Up @@ -73,3 +74,13 @@ def pytest_collection_modifyitems(config, items):
@pytest.fixture(autouse=True)
def add_np(doctest_namespace):
doctest_namespace['np'] = numpy


for module, replacement in {
'numpy.testing.decorators': 'numpy.testing.pytest_tools.decorators',
'numpy.testing.utils': 'numpy.testing.pytest_tools.utils',
}.items():
module = importlib.import_module(module)
replacement = importlib.import_module(replacement)
module.__dict__.clear()
module.__dict__.update(replacement.__dict__)
5 changes: 1 addition & 4 deletions numpy/testing/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
"""
import os

if int(os.getenv('NPY_PYTEST', '0')):
from .pytest_tools.decorators import *
else:
from .nose_tools.decorators import *
from .nose_tools.decorators import *
5 changes: 1 addition & 4 deletions numpy/testing/nosetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"""
import os

if int(os.getenv('NPY_PYTEST', '0')):
from .pytest_tools.nosetester import *
else:
from .nose_tools.nosetester import *
from .nose_tools.nosetester import *


__all__ = ['get_package_name', 'run_module_suite', 'NoseTester',
Expand Down
5 changes: 1 addition & 4 deletions numpy/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
"""
import os

if int(os.getenv('NPY_PYTEST', '0')):
from .pytest_tools.utils import *
else:
from .nose_tools.utils import *
from .nose_tools.utils import *

__all__ = [
'assert_equal', 'assert_almost_equal', 'assert_approx_equal',
Expand Down

0 comments on commit 0f7a8b3

Please sign in to comment.