Skip to content

Commit

Permalink
STY: PEP8 and pyflakes fixes for numpy/distutils.
Browse files Browse the repository at this point in the history
  • Loading branch information
charris committed Jul 25, 2015
1 parent ac193fa commit 1e99323
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 36 deletions.
3 changes: 1 addition & 2 deletions numpy/distutils/tests/f2py_ext/tests/test_fib2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from numpy.testing import TestCase, run_module_suite, assert_array_equal
from f2py_ext import fib2

class TestFib2(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions numpy/distutils/tests/f2py_f90_ext/tests/test_foo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from numpy.testing import TestCase, run_module_suite, assert_equal
from f2py_f90_ext import foo

class TestFoo(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions numpy/distutils/tests/gen_ext/tests/test_fib3.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from gen_ext import fib3
from numpy.testing import TestCase, run_module_suite, assert_array_equal

class TestFib3(TestCase):
def test_fib(self):
Expand Down
3 changes: 1 addition & 2 deletions numpy/distutils/tests/pyrex_ext/tests/test_primes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from numpy.testing import TestCase, run_module_suite, assert_equal
from pyrex_ext.primes import primes

class TestPrimes(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions numpy/distutils/tests/swig_ext/tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from numpy.testing import TestCase, run_module_suite, assert_equal
from swig_ext import example

class TestExample(TestCase):
Expand Down
3 changes: 1 addition & 2 deletions numpy/distutils/tests/swig_ext/tests/test_example2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import division, absolute_import, print_function

import sys
from numpy.testing import *
from numpy.testing import TestCase, run_module_suite
from swig_ext import example2

class TestExample2(TestCase):
Expand Down
10 changes: 5 additions & 5 deletions numpy/distutils/tests/test_fcompiler_intel.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from __future__ import division, absolute_import, print_function

from numpy.testing import *

import numpy.distutils.fcompiler
from numpy.testing import TestCase, run_module_suite, assert_


intel_32bit_version_strings = [
("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"\
("Intel(R) Fortran Intel(R) 32-bit Compiler Professional for applications"
"running on Intel(R) 32, Version 11.1", '11.1'),
]

intel_64bit_version_strings = [
("Intel(R) Fortran IA-64 Compiler Professional for applications"\
("Intel(R) Fortran IA-64 Compiler Professional for applications"
"running on IA-64, Version 11.0", '11.0'),
("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"\
("Intel(R) Fortran Intel(R) 64 Compiler Professional for applications"
"running on Intel(R) 64, Version 11.1", '11.1')
]

Expand Down
12 changes: 8 additions & 4 deletions numpy/distutils/tests/test_misc_util.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#!/usr/bin/env python
from __future__ import division, absolute_import, print_function

from numpy.testing import *
from numpy.distutils.misc_util import appendpath, minrelpath, \
gpaths, get_shared_lib_extension
from os.path import join, sep, dirname

from numpy.distutils.misc_util import (
appendpath, minrelpath, gpaths, get_shared_lib_extension
)
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal
)

ajoin = lambda *paths: join(*((sep,)+paths))

class TestAppendpath(TestCase):
Expand Down Expand Up @@ -53,7 +57,7 @@ def test_gpaths(self):
ls = gpaths('command/*.py', local_path)
assert_(join(local_path, 'command', 'build_src.py') in ls, repr(ls))
f = gpaths('system_info.py', local_path)
assert_(join(local_path, 'system_info.py')==f[0], repr(f))
assert_(join(local_path, 'system_info.py') == f[0], repr(f))

class TestSharedExtension(TestCase):

Expand Down
6 changes: 5 additions & 1 deletion numpy/distutils/tests/test_npy_pkg_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import os
from tempfile import mkstemp

from numpy.testing import *
from numpy.distutils.npy_pkg_config import read_config, parse_flags
from numpy.testing import TestCase, run_module_suite

simple = """\
[meta]
Expand Down Expand Up @@ -96,3 +96,7 @@ 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'])


if __name__ == '__main__':
run_module_suite()
30 changes: 16 additions & 14 deletions numpy/distutils/tests/test_system_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from numpy.distutils.system_info import system_info, ConfigParser
from numpy.distutils.system_info import default_lib_dirs, default_include_dirs


def get_class(name, notfound_action=1):
"""
notfound_action:
Expand Down Expand Up @@ -54,6 +55,7 @@ def get_class(name, notfound_action=1):


class test_system_info(system_info):

def __init__(self,
default_lib_dirs=default_lib_dirs,
default_include_dirs=default_include_dirs,
Expand All @@ -73,10 +75,10 @@ def __init__(self,
self.cp = ConfigParser(defaults)
# We have to parse the config files afterwards
# to have a consistent temporary filepath

def _check_libs(self, lib_dirs, libs, opt_libs, exts):
"""Override _check_libs to return with all dirs """
info = {'libraries' : libs , 'library_dirs' : lib_dirs}
info = {'libraries': libs, 'library_dirs': lib_dirs}
return info


Expand All @@ -102,11 +104,11 @@ def setUp(self):
# Update local site.cfg
global simple_site, site_cfg
site_cfg = simple_site.format(**{
'dir1' : self._dir1,
'lib1' : self._lib1,
'dir2' : self._dir2,
'lib2' : self._lib2
})
'dir1': self._dir1,
'lib1': self._lib1,
'dir2': self._dir2,
'lib2': self._lib2
})
# Write site.cfg
fd, self._sitecfg = mkstemp()
os.close(fd)
Expand All @@ -117,7 +119,8 @@ def setUp(self):
fd.write(fakelib_c_text)
with open(self._src2, 'w') as fd:
fd.write(fakelib_c_text)
# We create all class-instances
# We create all class-instances

def site_and_parse(c, site_cfg):
c.files = [site_cfg]
c.parse_config_files()
Expand All @@ -128,15 +131,15 @@ def site_and_parse(c, site_cfg):

def tearDown(self):
# Do each removal separately
try:
try:
shutil.rmtree(self._dir1)
except:
pass
try:
try:
shutil.rmtree(self._dir2)
except:
pass
try:
try:
os.remove(self._sitecfg)
except:
pass
Expand Down Expand Up @@ -165,11 +168,10 @@ def test_temp2(self):
# Now from rpath and not runtime_library_dirs
assert_equal(tsi.get_runtime_lib_dirs(key='rpath'), [self._dir2])
extra = tsi.calc_extra_info()
assert_equal(extra['extra_link_args'], ['-Wl,-rpath='+self._lib2])
assert_equal(extra['extra_link_args'], ['-Wl,-rpath=' + self._lib2])

def test_compile1(self):
# Compile source and link the first source
tsi = self.c_temp1
c = ccompiler.new_compiler()
try:
# Change directory to not screw up directories
Expand Down Expand Up @@ -198,6 +200,6 @@ def test_compile2(self):
os.chdir(previousDir)
except OSError:
pass

if __name__ == '__main__':
run_module_suite()

0 comments on commit 1e99323

Please sign in to comment.