Esempio n. 1
0
 def test_option(self):
     with nostderrout():
         run_mathematica(program='./input/mathematica_test_script.m',
                         option='-initfile ' +
                         './input/mathematica_init_script.m')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('mathematica test ended', logfile_data)
Esempio n. 2
0
 def test_change_dir(self):
     with nostderrout():
         run_mathematica(program='./input/mathematica_test_script.m',
                         changedir=True)
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('mathematica test ended', logfile_data)
     self.assertTrue(os.path.isfile('./input/output_plot.eps'))
Esempio n. 3
0
 def test_default_log(self):
     with nostderrout():
         run_mathematica(program='./input/mathematica_test_script.m')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('mathematica test ended', logfile_data)
     self.assertIn('Time   : ', logfile_data)
     self.assertTrue(os.path.isfile('output_plot.eps'))
Esempio n. 4
0
 def test_executable(self):
     with nostderrout():
         if sys.platform.startswith('darwin'):
             run_mathematica(program='./input/mathematica_test_script.m',
                             executable='mathematicascript')
         else:
             run_mathematica(program='./input/mathematica_test_script.m',
                             executable='mathkernel')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('mathematica test ended', logfile_data)
     self.assertTrue(os.path.isfile('output_plot.eps'))
Esempio n. 5
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_mathematica(program='./input/mathematica_test_script.m',
                         makelog='../output/custom_make.log')
     logfile_data = open('../output/custom_make.log', 'r').read()
     self.assertIn('mathematica test ended', logfile_data)
     self.assertTrue(os.path.isfile('output_plot.eps'))
Esempio n. 6
0
 def test_no_program(self):
     with nostderrout():
         run_mathematica(program='./input/nonexistent_mathematica_script.m')
     logfile_data = open('../output/make.log', 'r').readlines()
     self.assertIn('CritError:', logfile_data[-1])
Esempio n. 7
0
 def test_bad_executable(self):
     with nostderrout():
         run_mathematica(program='./input/mathematica_test_script.m',
                         executable='nonexistent_mathematica_executable')
     logfile_data = open('../output/make.log', 'r').read()
     self.assertIn('executed with errors', logfile_data)