Пример #1
0
 def test_options(self):
     with nostderrout():
         run_python(program='./input/python_test_script.py', option='-h')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn(
         'Options and arguments ' +
         '(and corresponding environment variables):', logfile_data)
Пример #2
0
 def test_executable(self):
     with nostderrout():
         run_python(program='./input/python_test_script.py',
                    executable='python')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('Test script complete', logfile_data)
     self.assertTrue(os.path.isfile('output.txt'))
Пример #3
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_python(program='./input/python_test_script.py',
                    makelog='../output/custom_make.log')
     logfile_data = open('../output/custom_make.log', 'r').read()
     self.assertIn('Test script complete', logfile_data)
     self.assertTrue(os.path.isfile('output.txt'))
Пример #4
0
 def test_args(self):
     with nostderrout():
         run_python(program='./input/python_test_script.py',
                    args='-i \'Input\'')
     output_data = open('output.txt', 'r').read()
     self.assertIn('Input', output_data)
Пример #5
0
 def test_no_program(self):
     with nostderrout():
         run_python(program='./input/nonexistent_python_script.py')
     logfile_data = open('../output/make.log', 'r').readlines()
     self.assertIn('CritError:', logfile_data[-1])
Пример #6
0
 def test_bad_executable(self):
     with nostderrout():
         run_python(program='./input/python_test_script.py',
                    executable='nonexistent_python_executable')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('executed with errors', logfile_data)