summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/distutils/tests/test_system_info.py2
-rw-r--r--numpy/f2py/tests/test_block_docstring.py4
-rw-r--r--numpy/f2py/tests/test_callback.py2
-rw-r--r--numpy/f2py/tests/test_common.py5
-rw-r--r--numpy/f2py/tests/util.py9
-rw-r--r--numpy/ma/tests/test_core.py4
-rw-r--r--numpy/testing/tests/test_utils.py21
7 files changed, 30 insertions, 17 deletions
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py
index 026179d37..de680298c 100644
--- a/numpy/distutils/tests/test_system_info.py
+++ b/numpy/distutils/tests/test_system_info.py
@@ -68,7 +68,7 @@ def have_compiler():
try:
if not compiler.initialized:
compiler.initialize() # MSVC is different
- except DistutilsError:
+ except (DistutilsError, ValueError):
return False
cmd = [compiler.cc]
try:
diff --git a/numpy/f2py/tests/test_block_docstring.py b/numpy/f2py/tests/test_block_docstring.py
index c3f9dc856..eb11201ef 100644
--- a/numpy/f2py/tests/test_block_docstring.py
+++ b/numpy/f2py/tests/test_block_docstring.py
@@ -1,9 +1,10 @@
from __future__ import division, absolute_import, print_function
import textwrap
+import sys
from . import util
-from numpy.testing import run_module_suite, assert_equal
+from numpy.testing import run_module_suite, assert_equal, dec
class TestBlockDocString(util.F2PyTest):
code = """
@@ -15,6 +16,7 @@ class TestBlockDocString(util.F2PyTest):
END
"""
+ @dec.knownfailureif(sys.platform=='win32', msg='Fails with MinGW64 Gfortran (Issue #9673)')
def test_block_docstring(self):
expected = "'i'-array(2,3)\n"
assert_equal(self.module.block.__doc__, expected)
diff --git a/numpy/f2py/tests/test_callback.py b/numpy/f2py/tests/test_callback.py
index ea29043ed..cf7427d20 100644
--- a/numpy/f2py/tests/test_callback.py
+++ b/numpy/f2py/tests/test_callback.py
@@ -2,6 +2,7 @@ from __future__ import division, absolute_import, print_function
import math
import textwrap
+import sys
from numpy import array
from numpy.testing import run_module_suite, assert_, assert_equal, dec
@@ -119,6 +120,7 @@ cf2py intent(out) a
r = t(a.mth)
assert_(r == 9, repr(r))
+ @dec.knownfailureif(sys.platform=='win32', msg='Fails with MinGW64 Gfortran (Issue #9673)')
def test_string_callback(self):
def callback(code):
diff --git a/numpy/f2py/tests/test_common.py b/numpy/f2py/tests/test_common.py
index aaa35b678..81082e575 100644
--- a/numpy/f2py/tests/test_common.py
+++ b/numpy/f2py/tests/test_common.py
@@ -1,11 +1,11 @@
from __future__ import division, absolute_import, print_function
import os
-
-from numpy.testing import run_module_suite, assert_array_equal, dec
+import sys
import numpy as np
from . import util
+from numpy.testing import run_module_suite, assert_array_equal, dec
def _path(*a):
return os.path.join(*((os.path.dirname(__file__),) + a))
@@ -13,6 +13,7 @@ def _path(*a):
class TestCommonBlock(util.F2PyTest):
sources = [_path('src', 'common', 'block.f')]
+ @dec.knownfailureif(sys.platform=='win32', msg='Fails with MinGW64 Gfortran (Issue #9673)')
def test_common_block(self):
self.module.initcb()
assert_array_equal(self.module.block.long_bn,
diff --git a/numpy/f2py/tests/util.py b/numpy/f2py/tests/util.py
index 55716a2eb..881b32810 100644
--- a/numpy/f2py/tests/util.py
+++ b/numpy/f2py/tests/util.py
@@ -16,10 +16,11 @@ import atexit
import textwrap
import re
import random
+import numpy.f2py
from numpy.compat import asbytes, asstr
-import numpy.f2py
-from numpy.testing import SkipTest, temppath
+from numpy.testing import SkipTest, temppath, dec
+from importlib import import_module
try:
from hashlib import md5
@@ -146,8 +147,7 @@ def build_module(source_files, options=[], skip=[], only=[], module_name=None):
os.unlink(fn)
# Import
- __import__(module_name)
- return sys.modules[module_name]
+ return import_module(module_name)
@_memoize
@@ -319,6 +319,7 @@ class F2PyTest(object):
module = None
module_name = None
+ @dec.knownfailureif(sys.platform=='win32', msg='Fails with MinGW64 Gfortran (Issue #9673)')
def setup(self):
if self.module is not None:
return
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index 8d4284140..41c56ca1e 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -13,6 +13,7 @@ import warnings
import pickle
import operator
import itertools
+import sys
from functools import reduce
@@ -47,6 +48,7 @@ from numpy.ma.core import (
ravel, repeat, reshape, resize, shape, sin, sinh, sometrue, sort, sqrt,
subtract, sum, take, tan, tanh, transpose, where, zeros,
)
+from numpy.testing import dec
pi = np.pi
@@ -3632,6 +3634,8 @@ class TestMaskedArrayMathMethods(object):
assert_almost_equal(np.sqrt(mXvar0[k]),
mX[:, k].compressed().std())
+ @dec.knownfailureif(sys.platform=='win32' and sys.version_info < (3, 6),
+ msg='Fails on Python < 3.6 (Issue #9671)')
@suppress_copy_mask_on_assignment
def test_varstd_specialcases(self):
# Test a special case for var
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 1a2a621ea..c440d8eca 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -267,15 +267,18 @@ class TestEqual(TestArrayEqual):
try:
self._assert_func(np.array([1, 2]), np.matrix([1, 2]))
except AssertionError as e:
- self.assertEqual(
- str(e),
- "\nArrays are not equal\n\n"
- "(shapes (2,), (1, 2) mismatch)\n"
- " x: array([1, 2])\n"
- " y: [repr failed for <matrix>: The truth value of an array "
- "with more than one element is ambiguous. Use a.any() or "
- "a.all()]")
-
+ msg = str(e)
+ msg2 = msg.replace("shapes (2L,), (1L, 2L)", "shapes (2,), (1, 2)")
+ msg_reference = "\nArrays are not equal\n\n" \
+ "(shapes (2,), (1, 2) mismatch)\n" \
+ " x: array([1, 2])\n" \
+ " y: [repr failed for <matrix>: The truth value of an array " \
+ "with more than one element is ambiguous. Use a.any() or " \
+ "a.all()]"
+ try:
+ self.assertEqual(msg, msg_reference)
+ except AssertionError:
+ self.assertEqual(msg2, msg_reference)
class TestArrayAlmostEqual(_GenericTest, unittest.TestCase):