コード例 #1
0
 def test_external_run(self):
     E = ExternalAnalysis('bash <INPUTFILE>',
                          self.test_file, {
                              'mytag': 'this_is_the_output',
                              'outputfile': 'pycmbstestfile.txt'
                          },
                          output_directory='./test/nothing')
     E.run()
     self.assertTrue(os.path.exists('./test/nothing/pycmbstestfile.txt'))
     os.remove('./test/nothing/pycmbstestfile.txt')
     os.system('rm -rf ./test')
コード例 #2
0
    def test_external_create_script(self):
        E = ExternalAnalysis('python <INPUTFILE>', self.test_file, {'mytag':'this_is_the_output', 'outputfile':'pycmbstestfile.txt'}, output_directory='./test/nothing')
        E._create_script()

        self.assertTrue(os.path.exists('./test/nothing/' + self.test_file))
        o = open('./test/nothing/' + self.test_file, 'r')
        l = o.readline()
        self.assertEqual(l, '#This is a testfile\n')
        l = o.readline()
        self.assertEqual(l, 'echo this_is_the_output\n')
        l = o.readline()
        self.assertEqual(l, 'touch pycmbstestfile.txt')
コード例 #3
0
 def test_external_output_dir(self):
     E = ExternalAnalysis('python <INPUTFILE>',
                          self.test_file, {'nothing': 'second'},
                          output_directory='./test/nothing')
     self.assertEqual(E.output_directory, './test/nothing/')
     self.assertTrue(os.path.exists('./test/nothing'))
     os.system('rm -rf ./test')
コード例 #4
0
    def test_external_create_script(self):
        E = ExternalAnalysis('python <INPUTFILE>',
                             self.test_file, {
                                 'mytag': 'this_is_the_output',
                                 'outputfile': 'pycmbstestfile.txt'
                             },
                             output_directory='./test/nothing')
        E._create_script()

        self.assertTrue(os.path.exists('./test/nothing/' + self.test_file))
        o = open('./test/nothing/' + self.test_file, 'r')
        l = o.readline()
        self.assertEqual(l, '#This is a testfile\n')
        l = o.readline()
        self.assertEqual(l, 'echo this_is_the_output\n')
        l = o.readline()
        self.assertEqual(l, 'touch pycmbstestfile.txt')
コード例 #5
0
 def test_external_run(self):
     E = ExternalAnalysis('bash <INPUTFILE>', self.test_file, {'mytag':'this_is_the_output', 'outputfile':'pycmbstestfile.txt'}, output_directory='./test/nothing')
     E.run()
     self.assertTrue(os.path.exists('./test/nothing/pycmbstestfile.txt'))
     os.remove('./test/nothing/pycmbstestfile.txt')
     os.system('rm -rf ./test')
コード例 #6
0
 def test_external_missing_template(self):
     with self.assertRaises(ValueError):
         E = ExternalAnalysis('python <INPUTFILE>',
                              'notemplate.txt', {'nothing': 'first'},
                              output_directory='./test/nothing')
コード例 #7
0
 def test_external_invalid_executable(self):
     with self.assertRaises(ValueError):
         E = ExternalAnalysis('python ', self.test_file,
                              {'nothing': 'first'})