summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/distutils/tests/test_exec_command.py82
-rw-r--r--numpy/distutils/tests/test_fcompiler_gnu.py6
-rw-r--r--numpy/distutils/tests/test_fcompiler_intel.py6
-rw-r--r--numpy/distutils/tests/test_misc_util.py10
-rw-r--r--numpy/distutils/tests/test_npy_pkg_config.py42
-rw-r--r--numpy/distutils/tests/test_system_info.py20
6 files changed, 84 insertions, 82 deletions
diff --git a/numpy/distutils/tests/test_exec_command.py b/numpy/distutils/tests/test_exec_command.py
index d5a0c5ae0..5e7b3f3e8 100644
--- a/numpy/distutils/tests/test_exec_command.py
+++ b/numpy/distutils/tests/test_exec_command.py
@@ -6,7 +6,7 @@ from tempfile import TemporaryFile
from numpy.distutils import exec_command
from numpy.distutils.exec_command import get_pythonexe
-from numpy.testing import TestCase, run_module_suite, tempdir
+from numpy.testing import run_module_suite, tempdir, assert_
# In python 3 stdout, stderr are text (unicode compliant) devices, so to
# emulate them import StringIO from the io module.
@@ -94,94 +94,94 @@ def test_exec_command_stderr():
exec_command.exec_command("cd '.'")
-class TestExecCommand(TestCase):
- def setUp(self):
+class TestExecCommand(object):
+ def setup(self):
self.pyexe = get_pythonexe()
def check_nt(self, **kws):
s, o = exec_command.exec_command('cmd /C echo path=%path%')
- self.assertEqual(s, 0)
- self.assertNotEqual(o, '')
+ assert_(s == 0)
+ assert_(o != '')
s, o = exec_command.exec_command(
'"%s" -c "import sys;sys.stderr.write(sys.platform)"' % self.pyexe)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'win32')
+ assert_(s == 0)
+ assert_(o == 'win32')
def check_posix(self, **kws):
s, o = exec_command.exec_command("echo Hello", **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Hello')
+ assert_(s == 0)
+ assert_(o == 'Hello')
s, o = exec_command.exec_command('echo $AAA', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, '')
+ assert_(s == 0)
+ assert_(o == '')
s, o = exec_command.exec_command('echo "$AAA"', AAA='Tere', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Tere')
+ assert_(s == 0)
+ assert_(o == 'Tere')
s, o = exec_command.exec_command('echo "$AAA"', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, '')
+ assert_(s == 0)
+ assert_(o == '')
if 'BBB' not in os.environ:
os.environ['BBB'] = 'Hi'
s, o = exec_command.exec_command('echo "$BBB"', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Hi')
+ assert_(s == 0)
+ assert_(o == 'Hi')
s, o = exec_command.exec_command('echo "$BBB"', BBB='Hey', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Hey')
+ assert_(s == 0)
+ assert_(o == 'Hey')
s, o = exec_command.exec_command('echo "$BBB"', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Hi')
+ assert_(s == 0)
+ assert_(o == 'Hi')
del os.environ['BBB']
s, o = exec_command.exec_command('echo "$BBB"', **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, '')
+ assert_(s == 0)
+ assert_(o == '')
s, o = exec_command.exec_command('this_is_not_a_command', **kws)
- self.assertNotEqual(s, 0)
- self.assertNotEqual(o, '')
+ assert_(s != 0)
+ assert_(o != '')
s, o = exec_command.exec_command('echo path=$PATH', **kws)
- self.assertEqual(s, 0)
- self.assertNotEqual(o, '')
+ assert_(s == 0)
+ assert_(o != '')
s, o = exec_command.exec_command(
'"%s" -c "import sys,os;sys.stderr.write(os.name)"' %
self.pyexe, **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'posix')
+ assert_(s == 0)
+ assert_(o == 'posix')
def check_basic(self, *kws):
s, o = exec_command.exec_command(
'"%s" -c "raise \'Ignore me.\'"' % self.pyexe, **kws)
- self.assertNotEqual(s, 0)
- self.assertNotEqual(o, '')
+ assert_(s != 0)
+ assert_(o != '')
s, o = exec_command.exec_command(
'"%s" -c "import sys;sys.stderr.write(\'0\');'
'sys.stderr.write(\'1\');sys.stderr.write(\'2\')"' %
self.pyexe, **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, '012')
+ assert_(s == 0)
+ assert_(o == '012')
s, o = exec_command.exec_command(
'"%s" -c "import sys;sys.exit(15)"' % self.pyexe, **kws)
- self.assertEqual(s, 15)
- self.assertEqual(o, '')
+ assert_(s == 15)
+ assert_(o == '')
s, o = exec_command.exec_command(
'"%s" -c "print(\'Heipa\'")' % self.pyexe, **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Heipa')
+ assert_(s == 0)
+ assert_(o == 'Heipa')
def check_execute_in(self, **kws):
with tempdir() as tmpdir:
@@ -194,13 +194,13 @@ class TestExecCommand(TestCase):
s, o = exec_command.exec_command(
'"%s" -c "f = open(\'%s\', \'r\'); f.close()"' %
(self.pyexe, fn), **kws)
- self.assertNotEqual(s, 0)
- self.assertNotEqual(o, '')
+ assert_(s != 0)
+ assert_(o != '')
s, o = exec_command.exec_command(
'"%s" -c "f = open(\'%s\', \'r\'); print(f.read()); '
'f.close()"' % (self.pyexe, fn), execute_in=tmpdir, **kws)
- self.assertEqual(s, 0)
- self.assertEqual(o, 'Hello')
+ assert_(s == 0)
+ assert_(o == 'Hello')
def test_basic(self):
with redirect_stdout(StringIO()):
diff --git a/numpy/distutils/tests/test_fcompiler_gnu.py b/numpy/distutils/tests/test_fcompiler_gnu.py
index 7ca99db22..9ad63cf09 100644
--- a/numpy/distutils/tests/test_fcompiler_gnu.py
+++ b/numpy/distutils/tests/test_fcompiler_gnu.py
@@ -1,6 +1,6 @@
from __future__ import division, absolute_import, print_function
-from numpy.testing import TestCase, assert_, run_module_suite
+from numpy.testing import assert_, run_module_suite
import numpy.distutils.fcompiler
@@ -29,7 +29,7 @@ gfortran_version_strings = [
'4.9.1')
]
-class TestG77Versions(TestCase):
+class TestG77Versions(object):
def test_g77_version(self):
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu')
for vs, version in g77_version_strings:
@@ -42,7 +42,7 @@ class TestG77Versions(TestCase):
v = fc.version_match(vs)
assert_(v is None, (vs, v))
-class TestGFortranVersions(TestCase):
+class TestGFortranVersions(object):
def test_gfortran_version(self):
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='gnu95')
for vs, version in gfortran_version_strings:
diff --git a/numpy/distutils/tests/test_fcompiler_intel.py b/numpy/distutils/tests/test_fcompiler_intel.py
index 8e371b92b..b13a01788 100644
--- a/numpy/distutils/tests/test_fcompiler_intel.py
+++ b/numpy/distutils/tests/test_fcompiler_intel.py
@@ -1,7 +1,7 @@
from __future__ import division, absolute_import, print_function
import numpy.distutils.fcompiler
-from numpy.testing import TestCase, run_module_suite, assert_
+from numpy.testing import run_module_suite, assert_
intel_32bit_version_strings = [
@@ -16,7 +16,7 @@ intel_64bit_version_strings = [
"running on Intel(R) 64, Version 11.1", '11.1')
]
-class TestIntelFCompilerVersions(TestCase):
+class TestIntelFCompilerVersions(object):
def test_32bit_version(self):
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intel')
for vs, version in intel_32bit_version_strings:
@@ -24,7 +24,7 @@ class TestIntelFCompilerVersions(TestCase):
assert_(v == version)
-class TestIntelEM64TFCompilerVersions(TestCase):
+class TestIntelEM64TFCompilerVersions(object):
def test_64bit_version(self):
fc = numpy.distutils.fcompiler.new_fcompiler(compiler='intelem')
for vs, version in intel_64bit_version_strings:
diff --git a/numpy/distutils/tests/test_misc_util.py b/numpy/distutils/tests/test_misc_util.py
index f7fcbe224..dd4dbc842 100644
--- a/numpy/distutils/tests/test_misc_util.py
+++ b/numpy/distutils/tests/test_misc_util.py
@@ -6,12 +6,12 @@ from numpy.distutils.misc_util import (
appendpath, minrelpath, gpaths, get_shared_lib_extension, get_info
)
from numpy.testing import (
- TestCase, run_module_suite, assert_, assert_equal
+ run_module_suite, assert_, assert_equal
)
ajoin = lambda *paths: join(*((sep,)+paths))
-class TestAppendpath(TestCase):
+class TestAppendpath(object):
def test_1(self):
assert_equal(appendpath('prefix', 'name'), join('prefix', 'name'))
@@ -35,7 +35,7 @@ class TestAppendpath(TestCase):
assert_equal(appendpath('/prefix/sub/sub2', '/prefix/sub/sup/name'),
ajoin('prefix', 'sub', 'sub2', 'sup', 'name'))
-class TestMinrelpath(TestCase):
+class TestMinrelpath(object):
def test_1(self):
n = lambda path: path.replace('/', sep)
@@ -49,7 +49,7 @@ class TestMinrelpath(TestCase):
assert_equal(minrelpath(n('.././..')), n('../..'))
assert_equal(minrelpath(n('aa/bb/.././../dd')), n('dd'))
-class TestGpaths(TestCase):
+class TestGpaths(object):
def test_gpaths(self):
local_path = minrelpath(join(dirname(__file__), '..'))
@@ -58,7 +58,7 @@ class TestGpaths(TestCase):
f = gpaths('system_info.py', local_path)
assert_(join(local_path, 'system_info.py') == f[0], repr(f))
-class TestSharedExtension(TestCase):
+class TestSharedExtension(object):
def test_get_shared_lib_extension(self):
import sys
diff --git a/numpy/distutils/tests/test_npy_pkg_config.py b/numpy/distutils/tests/test_npy_pkg_config.py
index bdef47167..29891b63b 100644
--- a/numpy/distutils/tests/test_npy_pkg_config.py
+++ b/numpy/distutils/tests/test_npy_pkg_config.py
@@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function
import os
from numpy.distutils.npy_pkg_config import read_config, parse_flags
-from numpy.testing import TestCase, run_module_suite, temppath
+from numpy.testing import run_module_suite, temppath, assert_
simple = """\
[meta]
@@ -36,7 +36,7 @@ libs = -L${libdir}
simple_variable_d = {'cflags': '-I/foo/bar/include', 'libflags': '-L/foo/bar/lib',
'version': '0.1', 'name': 'foo'}
-class TestLibraryInfo(TestCase):
+class TestLibraryInfo(object):
def test_simple(self):
with temppath('foo.ini') as path:
with open(path, 'w') as f:
@@ -44,10 +44,10 @@ class TestLibraryInfo(TestCase):
pkg = os.path.splitext(path)[0]
out = read_config(pkg)
- self.assertTrue(out.cflags() == simple_d['cflags'])
- self.assertTrue(out.libs() == simple_d['libflags'])
- self.assertTrue(out.name == simple_d['name'])
- self.assertTrue(out.version == simple_d['version'])
+ assert_(out.cflags() == simple_d['cflags'])
+ assert_(out.libs() == simple_d['libflags'])
+ assert_(out.name == simple_d['name'])
+ assert_(out.version == simple_d['version'])
def test_simple_variable(self):
with temppath('foo.ini') as path:
@@ -56,34 +56,34 @@ class TestLibraryInfo(TestCase):
pkg = os.path.splitext(path)[0]
out = read_config(pkg)
- self.assertTrue(out.cflags() == simple_variable_d['cflags'])
- self.assertTrue(out.libs() == simple_variable_d['libflags'])
- self.assertTrue(out.name == simple_variable_d['name'])
- self.assertTrue(out.version == simple_variable_d['version'])
+ assert_(out.cflags() == simple_variable_d['cflags'])
+ assert_(out.libs() == simple_variable_d['libflags'])
+ assert_(out.name == simple_variable_d['name'])
+ assert_(out.version == simple_variable_d['version'])
out.vars['prefix'] = '/Users/david'
- self.assertTrue(out.cflags() == '-I/Users/david/include')
+ assert_(out.cflags() == '-I/Users/david/include')
-class TestParseFlags(TestCase):
+class TestParseFlags(object):
def test_simple_cflags(self):
d = parse_flags("-I/usr/include")
- self.assertTrue(d['include_dirs'] == ['/usr/include'])
+ assert_(d['include_dirs'] == ['/usr/include'])
d = parse_flags("-I/usr/include -DFOO")
- self.assertTrue(d['include_dirs'] == ['/usr/include'])
- self.assertTrue(d['macros'] == ['FOO'])
+ assert_(d['include_dirs'] == ['/usr/include'])
+ assert_(d['macros'] == ['FOO'])
d = parse_flags("-I /usr/include -DFOO")
- self.assertTrue(d['include_dirs'] == ['/usr/include'])
- self.assertTrue(d['macros'] == ['FOO'])
+ assert_(d['include_dirs'] == ['/usr/include'])
+ assert_(d['macros'] == ['FOO'])
def test_simple_lflags(self):
d = parse_flags("-L/usr/lib -lfoo -L/usr/lib -lbar")
- self.assertTrue(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
- self.assertTrue(d['libraries'] == ['foo', 'bar'])
+ assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+ assert_(d['libraries'] == ['foo', 'bar'])
d = parse_flags("-L /usr/lib -lfoo -L/usr/lib -lbar")
- self.assertTrue(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
- self.assertTrue(d['libraries'] == ['foo', 'bar'])
+ assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib'])
+ assert_(d['libraries'] == ['foo', 'bar'])
if __name__ == '__main__':
diff --git a/numpy/distutils/tests/test_system_info.py b/numpy/distutils/tests/test_system_info.py
index 59b4cc125..026179d37 100644
--- a/numpy/distutils/tests/test_system_info.py
+++ b/numpy/distutils/tests/test_system_info.py
@@ -8,7 +8,7 @@ from distutils.errors import DistutilsError
from numpy.distutils import ccompiler
from numpy.testing import (
- TestCase, run_module_suite, assert_, assert_equal, dec
+ run_module_suite, assert_, assert_equal, dec
)
from numpy.distutils.system_info import system_info, ConfigParser
from numpy.distutils.system_info import default_lib_dirs, default_include_dirs
@@ -21,9 +21,9 @@ def get_class(name, notfound_action=1):
1 - display warning message
2 - raise error
"""
- cl = {'temp1': TestTemp1,
- 'temp2': TestTemp2
- }.get(name.lower(), test_system_info)
+ cl = {'temp1': Temp1Info,
+ 'temp2': Temp2Info
+ }.get(name.lower(), _system_info)
return cl()
simple_site = """
@@ -84,7 +84,7 @@ def have_compiler():
HAVE_COMPILER = have_compiler()
-class test_system_info(system_info):
+class _system_info(system_info):
def __init__(self,
default_lib_dirs=default_lib_dirs,
@@ -111,17 +111,19 @@ class test_system_info(system_info):
return info
-class TestTemp1(test_system_info):
+class Temp1Info(_system_info):
+ """For testing purposes"""
section = 'temp1'
-class TestTemp2(test_system_info):
+class Temp2Info(_system_info):
+ """For testing purposes"""
section = 'temp2'
-class TestSystemInfoReading(TestCase):
+class TestSystemInfoReading(object):
- def setUp(self):
+ def setup(self):
""" Create the libraries """
# Create 2 sources and 2 libraries
self._dir1 = mkdtemp()