Back to index

python3.2  3.2.2
Public Member Functions
distutils.tests.test_extension.ExtensionTestCase Class Reference

List of all members.

Public Member Functions

def test_read_setup_file
def test_extension_init

Detailed Description

Definition at line 9 of file test_extension.py.


Member Function Documentation

Definition at line 33 of file test_extension.py.

00033 
00034     def test_extension_init(self):
00035         # the first argument, which is the name, must be a string
00036         self.assertRaises(AssertionError, Extension, 1, [])
00037         ext = Extension('name', [])
00038         self.assertEqual(ext.name, 'name')
00039 
00040         # the second argument, which is the list of files, must
00041         # be a list of strings
00042         self.assertRaises(AssertionError, Extension, 'name', 'file')
00043         self.assertRaises(AssertionError, Extension, 'name', ['file', 1])
00044         ext = Extension('name', ['file1', 'file2'])
00045         self.assertEqual(ext.sources, ['file1', 'file2'])
00046 
00047         # others arguments have defaults
00048         for attr in ('include_dirs', 'define_macros', 'undef_macros',
00049                      'library_dirs', 'libraries', 'runtime_library_dirs',
00050                      'extra_objects', 'extra_compile_args', 'extra_link_args',
00051                      'export_symbols', 'swig_opts', 'depends'):
00052             self.assertEqual(getattr(ext, attr), [])
00053 
00054         self.assertEqual(ext.language, None)
00055         self.assertEqual(ext.optional, None)
00056 
00057         # if there are unknown keyword options, warn about them
00058         with check_warnings() as w:
00059             warnings.simplefilter('always')
00060             ext = Extension('name', ['file1', 'file2'], chic=True)
00061 
00062         self.assertEqual(len(w.warnings), 1)
00063         self.assertEqual(str(w.warnings[0].message),
00064                           "Unknown Extension options: 'chic'")

Here is the call graph for this function:

Definition at line 11 of file test_extension.py.

00011 
00012     def test_read_setup_file(self):
00013         # trying to read a Setup file
00014         # (sample extracted from the PyGame project)
00015         setup = os.path.join(os.path.dirname(__file__), 'Setup.sample')
00016 
00017         exts = read_setup_file(setup)
00018         names = [ext.name for ext in exts]
00019         names.sort()
00020 
00021         # here are the extensions read_setup_file should have created
00022         # out of the file
00023         wanted = ['_arraysurfarray', '_camera', '_numericsndarray',
00024                   '_numericsurfarray', 'base', 'bufferproxy', 'cdrom',
00025                   'color', 'constants', 'display', 'draw', 'event',
00026                   'fastevent', 'font', 'gfxdraw', 'image', 'imageext',
00027                   'joystick', 'key', 'mask', 'mixer', 'mixer_music',
00028                   'mouse', 'movie', 'overlay', 'pixelarray', 'pypm',
00029                   'rect', 'rwobject', 'scrap', 'surface', 'surflock',
00030                   'time', 'transform']
00031 
00032         self.assertEqual(names, wanted)

Here is the call graph for this function:


The documentation for this class was generated from the following file: