Exemplo n.º 1
0
 def test_default_log(self):
     with nostderrout():
         run_perl(program='./input/perl_test_script.pl')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('Test script completed', logfile_data)
     self.assertIn('Time   : ', logfile_data)
     self.assertTrue(os.path.isfile('output.txt'))
Exemplo n.º 2
0
 def test_custom_log(self):
     os.remove('../output/make.log')
     makelog_file = '../output/custom_make.log'
     output_dir = '../output/'
     with nostderrout():
         clear_output_dirs(output_dir, '')
         start_make_logging(makelog_file)
         run_perl(program='./input/perl_test_script.pl',
                  makelog='../output/custom_make.log')
     logfile_data = open('../output/custom_make.log', 'r').read()
     self.assertIn('Test script completed', logfile_data)
     self.assertTrue(os.path.isfile('output.txt'))
Exemplo n.º 3
0
 def test_perl_error(self):
     with nostderrout():
         run_perl(program='./input/perl_test_script_error.pl')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('executed with errors', logfile_data)
Exemplo n.º 4
0
 def test_args(self):
     with nostderrout():
         run_perl(program='./input/perl_test_script.pl', args='\'Input\'')
     output_data = open('output.txt', 'r').read()
     self.assertIn('Input', output_data)
Exemplo n.º 5
0
 def test_option(self):
     with nostderrout():
         run_perl(program='./input/perl_test_script.pl', option='-h')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('Usage:', logfile_data)
Exemplo n.º 6
0
 def test_no_program(self):
     with nostderrout():
         run_perl(program='./input/nonexistent_perl_script.pl')
     logfile_data = open('../output/make.log', 'r').readlines()
     self.assertIn('CritError:', logfile_data[-1])
Exemplo n.º 7
0
 def test_bad_executable(self):
     with nostderrout():
         run_perl(program='./input/perl_test_script.pl',
                  executable='nonexistent_perl_executable')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('executed with errors', logfile_data)