Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
distutils.tests.test_cmd.CommandTestCase Class Reference

List of all members.

Public Member Functions

def setUp
def test_ensure_string_list
def test_make_file
def test_dump_options
def test_ensure_string
def test_ensure_string_list
def test_ensure_filename
def test_ensure_dirname
def test_debug_print

Public Attributes

 cmd

Detailed Description

Definition at line 15 of file test_cmd.py.


Member Function Documentation

Definition at line 17 of file test_cmd.py.

00017 
00018     def setUp(self):
00019         dist = Distribution()
00020         self.cmd = MyCmd(dist)

Here is the caller graph for this function:

Definition at line 107 of file test_cmd.py.

00107 
00108     def test_debug_print(self):
00109         cmd = self.cmd
00110         with captured_stdout() as stdout:
00111             cmd.debug_print('xxx')
00112         stdout.seek(0)
00113         self.assertEqual(stdout.read(), '')
00114 
00115         debug.DEBUG = True
00116         try:
00117             with captured_stdout() as stdout:
00118                 cmd.debug_print('xxx')
00119             stdout.seek(0)
00120             self.assertEqual(stdout.read(), 'xxx\n')
00121         finally:
00122             debug.DEBUG = False

Here is the call graph for this function:

Definition at line 52 of file test_cmd.py.

00052 
00053     def test_dump_options(self):
00054 
00055         msgs = []
00056         def _announce(msg, level):
00057             msgs.append(msg)
00058         cmd = self.cmd
00059         cmd.announce = _announce
00060         cmd.option1 = 1
00061         cmd.option2 = 1
00062         cmd.user_options = [('option1', '', ''), ('option2', '', '')]
00063         cmd.dump_options()
00064 
00065         wanted = ["command options for 'MyCmd':", '  option1 = 1',
00066                   '  option2 = 1']
00067         self.assertEqual(msgs, wanted)

Here is the call graph for this function:

Definition at line 100 of file test_cmd.py.

00100 
00101     def test_ensure_dirname(self):
00102         cmd = self.cmd
00103         cmd.option1 = os.path.dirname(__file__) or os.curdir
00104         cmd.ensure_dirname('option1')
00105         cmd.option2 = 'xxx'
00106         self.assertRaises(DistutilsOptionError, cmd.ensure_dirname, 'option2')

Here is the call graph for this function:

Definition at line 93 of file test_cmd.py.

00093 
00094     def test_ensure_filename(self):
00095         cmd = self.cmd
00096         cmd.option1 = __file__
00097         cmd.ensure_filename('option1')
00098         cmd.option2 = 'xxx'
00099         self.assertRaises(DistutilsOptionError, cmd.ensure_filename, 'option2')

Here is the call graph for this function:

Definition at line 68 of file test_cmd.py.

00068 
00069     def test_ensure_string(self):
00070         cmd = self.cmd
00071         cmd.option1 = 'ok'
00072         cmd.ensure_string('option1')
00073 
00074         cmd.option2 = None
00075         cmd.ensure_string('option2', 'xxx')
00076         self.assertTrue(hasattr(cmd, 'option2'))
00077 
00078         cmd.option3 = 1
00079         self.assertRaises(DistutilsOptionError, cmd.ensure_string, 'option3')

Here is the call graph for this function:

Definition at line 21 of file test_cmd.py.

00021 
00022     def test_ensure_string_list(self):
00023 
00024         cmd = self.cmd
00025         cmd.not_string_list = ['one', 2, 'three']
00026         cmd.yes_string_list = ['one', 'two', 'three']
00027         cmd.not_string_list2 = object()
00028         cmd.yes_string_list2 = 'ok'
00029         cmd.ensure_string_list('yes_string_list')
00030         cmd.ensure_string_list('yes_string_list2')
00031 
00032         self.assertRaises(DistutilsOptionError,
00033                           cmd.ensure_string_list, 'not_string_list')
00034 
00035         self.assertRaises(DistutilsOptionError,
00036                           cmd.ensure_string_list, 'not_string_list2')

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 80 of file test_cmd.py.

00080 
00081     def test_ensure_string_list(self):
00082         cmd = self.cmd
00083         cmd.option1 = 'ok,dok'
00084         cmd.ensure_string_list('option1')
00085         self.assertEqual(cmd.option1, ['ok', 'dok'])
00086 
00087         cmd.option2 = ['xxx', 'www']
00088         cmd.ensure_string_list('option2')
00089 
00090         cmd.option3 = ['ok', 2]
00091         self.assertRaises(DistutilsOptionError, cmd.ensure_string_list,
00092                           'option3')

Here is the call graph for this function:

Definition at line 37 of file test_cmd.py.

00037 
00038     def test_make_file(self):
00039 
00040         cmd = self.cmd
00041 
00042         # making sure it raises when infiles is not a string or a list/tuple
00043         self.assertRaises(TypeError, cmd.make_file,
00044                           infiles=1, outfile='', func='func', args=())
00045 
00046         # making sure execute gets called properly
00047         def _execute(func, args, exec_msg, level):
00048             self.assertEqual(exec_msg, 'generating out from in')
00049         cmd.force = True
00050         cmd.execute = _execute
00051         cmd.make_file(infiles='in', outfile='out', func='func', args=())

Here is the call graph for this function:


Member Data Documentation

Definition at line 19 of file test_cmd.py.


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