OXIESEC PANEL
- Current Dir:
/
/
usr
/
local
/
lib
/
python3.6
/
dist-packages
/
numpy
/
distutils
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 05:59:26 AM
rwxr-xr-x
📄
__init__.py
0 bytes
10/28/2024 05:59:24 AM
rw-r--r--
📁
__pycache__
-
10/28/2024 05:59:26 AM
rwxr-xr-x
📄
test_exec_command.py
7.13 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_fcompiler.py
1.25 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_fcompiler_gnu.py
2.09 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_fcompiler_intel.py
1.03 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_fcompiler_nagfor.py
1.08 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_from_template.py
1.08 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_mingw32ccompiler.py
1.57 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_misc_util.py
3.14 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_npy_pkg_config.py
2.5 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_shell_utils.py
1.91 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_system_info.py
9.48 KB
10/28/2024 05:59:24 AM
rw-r--r--
Editing: test_npy_pkg_config.py
Close
import os from numpy.distutils.npy_pkg_config import read_config, parse_flags from numpy.testing import temppath, assert_ simple = """\ [meta] Name = foo Description = foo lib Version = 0.1 [default] cflags = -I/usr/include libs = -L/usr/lib """ simple_d = {'cflags': '-I/usr/include', 'libflags': '-L/usr/lib', 'version': '0.1', 'name': 'foo'} simple_variable = """\ [meta] Name = foo Description = foo lib Version = 0.1 [variables] prefix = /foo/bar libdir = ${prefix}/lib includedir = ${prefix}/include [default] cflags = -I${includedir} libs = -L${libdir} """ simple_variable_d = {'cflags': '-I/foo/bar/include', 'libflags': '-L/foo/bar/lib', 'version': '0.1', 'name': 'foo'} class TestLibraryInfo: def test_simple(self): with temppath('foo.ini') as path: with open(path, 'w') as f: f.write(simple) pkg = os.path.splitext(path)[0] out = read_config(pkg) 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: with open(path, 'w') as f: f.write(simple_variable) pkg = os.path.splitext(path)[0] out = read_config(pkg) 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' assert_(out.cflags() == '-I/Users/david/include') class TestParseFlags: def test_simple_cflags(self): d = parse_flags("-I/usr/include") assert_(d['include_dirs'] == ['/usr/include']) d = parse_flags("-I/usr/include -DFOO") assert_(d['include_dirs'] == ['/usr/include']) assert_(d['macros'] == ['FOO']) d = parse_flags("-I /usr/include -DFOO") 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") assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib']) assert_(d['libraries'] == ['foo', 'bar']) d = parse_flags("-L /usr/lib -lfoo -L/usr/lib -lbar") assert_(d['library_dirs'] == ['/usr/lib', '/usr/lib']) assert_(d['libraries'] == ['foo', 'bar'])