Esempio n. 1
0
 def test_program_space(self):        
     with no_stderrout():
         paths = self.make_paths(makelog_path = 'test/log/make space.log')
         program_name = 'test/raw/run_program/%s_script space.%s' % (self.app, self.ext)
         run_function(paths, program = program_name)
         
     self.check_output(paths)
Esempio n. 2
0
 def test_program(self):        
     with no_stderrout():
         paths = self.make_paths()
         program_name = 'test/raw/run_program/%s_script.%s' % (self.app, self.ext)
         run_function(paths, program = program_name)
         
     self.check_output(paths)
Esempio n. 3
0
 def test_log_space(self):      
     with no_stderrout():
         paths = self.make_paths()
         program_name = 'test/raw/run_program/%s_script.%s' % (self.app, self.ext)
         run_function(paths, program = program_name, log = 'test/output/log space.log')
         
     self.check_output(paths)
     self.assertIn('Test script complete', read_file('test/output/log space.log'))
Esempio n. 4
0
 def test_error_bad_arg(self):      
     try:
         with no_stderrout():
             paths = self.make_paths()
             program_name = 'test/raw/run_program/%s_script.%s' % (self.app, self.ext)
             run_function(paths, program = program_name, arg = [])    
     except Exception as e:
         self.assertRaises(Exception, e)
Esempio n. 5
0
    def test_program_handout(self):
        with no_stderrout():
            paths = self.make_paths()
            program_name = 'test/raw/run_program/%s_file_handout.%s' % (
                self.app, self.ext)
            run_function(paths, program=program_name, doctype='handout')

        self.check_output(paths, '%s_file_handout.pdf' % self.app)
Esempio n. 6
0
 def test_error_program_wrong_extension(self):      
     try:
         with no_stderrout():
             paths = self.make_paths()
             program_name = 'test/raw/run_program/wrong_extension.txt'
             run_function(paths, program = program_name)           
     except Exception as e:
         self.assertRaises(Exception, e)
Esempio n. 7
0
    def test_program_character(self):
        with no_stderrout():
            paths = self.make_paths(makelog_path='test/log/make_╬▓.log')
            program_name = 'test/raw/run_program/%s_file_╬▓.%s' % (self.app,
                                                                   self.ext)
            run_function(paths, program=program_name)

        self.check_output(paths, '%s_file_╬▓.pdf' % self.app)
Esempio n. 8
0
    def test_no_log(self):        
        with no_stderrout():
            paths = self.make_paths(makelog_path = '')
            program_name = 'test/raw/run_program/%s_script.%s' % (self.app, self.ext)
            run_function(paths, program = program_name, log = '')

        self.assertFalse(os.path.isfile(paths['makelog']))
        self.assertFalse(os.path.isfile('test/output/log.log'))
        self.assertTrue(os.path.isfile('test/output/output.csv'))
Esempio n. 9
0
 def test_program_arg(self):      
     with no_stderrout():
         paths = self.make_paths()
         program_name = 'test/raw/run_program/%s_script_arg.%s' % (self.app, self.ext)
         run_function(paths, program = program_name, args = self.arg)
     
     self.check_output(paths)
     output = read_file('test/output/output.csv')
     self.assertTrue(re.search('arg', output))
Esempio n. 10
0
 def test_error_program_missing(self):
     try:
         with no_stderrout():
             paths = self.make_paths()
             program_name = 'test/raw/run_program/%s_file_missing.%s' % (
                 self.app, self.ext)
             run_function(paths, program=program_name)
     except Exception as e:
         self.assertRaises(Exception, e)
Esempio n. 11
0
    def test_program_executable(self):
        with no_stderrout():
            paths = self.make_paths()
            program_name = 'test/raw/run_program/%s_file.%s' % (self.app,
                                                                self.ext)
            run_function(paths,
                         program=program_name,
                         executable=self.executable)

        self.check_output(paths)
Esempio n. 12
0
    def test_log_character(self):
        with no_stderrout():
            paths = self.make_paths()
            program_name = 'test/raw/run_program/%s_file.%s' % (self.app,
                                                                self.ext)
            run_function(paths,
                         program=program_name,
                         log='test/output/log_╬▓.log')

        self.check_output(paths)
        self.assertIn('Executing command', read_file('test/output/log_╬▓.log'))
Esempio n. 13
0
 def test_program_character(self):  
     """
     Note
     ----
     Rscript can have difficulties finding file names with non-ASCII characters.
     """          
     with no_stderrout():
         paths = self.make_paths(makelog_path = 'test/log/make_╬▓.log')
         program_name = 'test/raw/run_program/%s_script_╬▓.%s' % (self.app, self.ext)
         run_function(paths, program = program_name)
         
     self.check_output(paths)
Esempio n. 14
0
 def test_error_bad_program(self):      
     with self.assertRaises(Exception):
         with no_stderrout():
             paths = self.make_paths()
             program_name = 'test/raw/run_program/%s_script_error.%s' % (self.app, self.ext)
             run_function(paths, program = program_name)          
Esempio n. 15
0
 def test_error_program_dir(self):      
     with self.assertRaises(Exception):
         with no_stderrout():
             paths = self.make_paths()
             program_name = 'test/raw/run_program/program/'
             run_function(paths, program = program_name)