summaryrefslogtreecommitdiff
path: root/numpy/ma
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-07-04 13:47:45 -0600
committerCharles Harris <charlesr.harris@gmail.com>2017-07-04 19:51:58 -0600
commitae84af3b6e6d96e4be408e8a56408290ee1879db (patch)
tree0eff73d96f270e8d3aed3fc660e9926f023fde0d /numpy/ma
parent0e4253526c727f50696f6233fee3d50a419ba9fe (diff)
downloadnumpy-ae84af3b6e6d96e4be408e8a56408290ee1879db.tar.gz
MAINT: Rearrange files in numpy/testing module.
The aim here is to separate out the nose dependent files prior to adding pytest support. This could be done by adding new files to the general numpy/testing directory, but I felt that it was to have the relevant files separated out as it makes it easier to completely remove nose dependencies when needed. Many places were accessing submodules in numpy/testing directly, and in some cases incorrectly. That presented a backwards compatibility problem. The solution adapted here is to have "dummy" files whose contents will depend on whether of not pytest is active. That way the module looks the same as before from the outside. In the case of numpy itself, direct accesses have been fixed. Having proper `__all__` lists in the submodules helped in that.
Diffstat (limited to 'numpy/ma')
-rw-r--r--numpy/ma/__init__.py2
-rw-r--r--numpy/ma/tests/test_core.py7
-rw-r--r--numpy/ma/testutils.py12
-rw-r--r--numpy/ma/timer_comparison.py2
4 files changed, 12 insertions, 11 deletions
diff --git a/numpy/ma/__init__.py b/numpy/ma/__init__.py
index af3468b01..fbefc47a4 100644
--- a/numpy/ma/__init__.py
+++ b/numpy/ma/__init__.py
@@ -51,6 +51,6 @@ __all__ = ['core', 'extras']
__all__ += core.__all__
__all__ += extras.__all__
-from numpy.testing.nosetester import _numpy_tester
+from numpy.testing import _numpy_tester
test = _numpy_tester().test
bench = _numpy_tester().bench
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 707fcd1de..e8f18344c 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -20,7 +20,8 @@ import numpy.ma.core
import numpy.core.fromnumeric as fromnumeric
import numpy.core.umath as umath
from numpy.testing import (
- TestCase, run_module_suite, assert_raises, assert_warns, suppress_warnings)
+ TestCase, run_module_suite, assert_raises, assert_warns, suppress_warnings
+ )
from numpy import ndarray
from numpy.compat import asbytes, asbytes_nested
from numpy.ma.testutils import (
@@ -1872,11 +1873,11 @@ class TestFillingValues(TestCase):
"h", "D", "W", "M", "Y"):
control = numpy.datetime64("NaT", timecode)
test = default_fill_value(numpy.dtype("<M8[" + timecode + "]"))
- np.testing.utils.assert_equal(test, control)
+ np.testing.assert_equal(test, control)
control = numpy.timedelta64("NaT", timecode)
test = default_fill_value(numpy.dtype("<m8[" + timecode + "]"))
- np.testing.utils.assert_equal(test, control)
+ np.testing.assert_equal(test, control)
def test_extremum_fill_value(self):
# Tests extremum fill values for flexible type.
diff --git a/numpy/ma/testutils.py b/numpy/ma/testutils.py
index c19066d71..a95c170c8 100644
--- a/numpy/ma/testutils.py
+++ b/numpy/ma/testutils.py
@@ -12,11 +12,11 @@ import operator
import numpy as np
from numpy import ndarray, float_
import numpy.core.umath as umath
+import numpy.testing
from numpy.testing import (
TestCase, assert_, assert_allclose, assert_array_almost_equal_nulp,
assert_raises, build_err_msg, run_module_suite
)
-import numpy.testing.utils as utils
from .core import mask_or, getmask, masked_array, nomask, masked, filled
__all__masked = [
@@ -211,11 +211,11 @@ def assert_array_compare(comparison, x, y, err_msg='', verbose=True, header='',
header=header, names=('x', 'y'))
raise ValueError(msg)
# OK, now run the basic tests on filled versions
- return utils.assert_array_compare(comparison,
- x.filled(fill_value),
- y.filled(fill_value),
- err_msg=err_msg,
- verbose=verbose, header=header)
+ return np.testing.assert_array_compare(comparison,
+ x.filled(fill_value),
+ y.filled(fill_value),
+ err_msg=err_msg,
+ verbose=verbose, header=header)
def assert_array_equal(x, y, err_msg='', verbose=True):
diff --git a/numpy/ma/timer_comparison.py b/numpy/ma/timer_comparison.py
index dae4b141b..68104ed0a 100644
--- a/numpy/ma/timer_comparison.py
+++ b/numpy/ma/timer_comparison.py
@@ -7,7 +7,7 @@ import numpy as np
from numpy import float_
import numpy.core.fromnumeric as fromnumeric
-from numpy.testing.utils import build_err_msg
+from numpy.testing import build_err_msg
# Fixme: this does not look right.
np.seterr(all='ignore')