예제 #1
0
 def test_nonexistent_target_directory(self, mock_system):
     '''
     Test build_lyx()'s behaviour when the target file's
     directory does not exist.
     '''
     mock_system.side_effect = fx.lyx_side_effect
     with self.assertRaises(TypeError):
         gs.build_lyx('./nonexistent_directory/lyx.pdf', 
                      ['./input/lyx_test_file.lyx'], env = True)
예제 #2
0
 def test_env_argument(self, mock_system):
     '''
     Test that numerous types of objects can be passed to 
     build_lyx() without affecting the function's operation.
     '''
     mock_system.side_effect = fx.lyx_side_effect
     target = './build/lyx.pdf'
     source = ['./input/lyx_test_file.lyx']
     log    = './build/sconscript.log'
     
     for env in [True, [1, 2, 3], ('a', 'b'), None, TypeError]:
         with self.assertRaises(TypeError):
             gs.build_lyx(target, source, env = env)
예제 #3
0
 def test_nonexistent_source(self, mock_system):
     '''
     Test build_lyx()'s behaviour when the source file
     does not exist.
     '''
     mock_system.side_effect = fx.lyx_side_effect
     # i) Directory doesn't exist
     with self.assertRaises(ExecCallError):
         gs.build_lyx('./build/lyx.pdf', 
                      ['./bad_dir/lyx_test_file.lyx'], env = {})
     # ii) Directory exists, but file doesn't
     with self.assertRaises(ExecCallError):
         gs.build_lyx('./build/lyx.pdf', 
                      ['./input/nonexistent_file.lyx'], env = {})