Esempio n. 1
0
 def testOneFile(self):
     # When checking output, ignore differences in version and time
     try:
         main(["-c", ONE_FILE_INI])
         diffs = diff_lines(GLU_DATA_OUT, GOOD_GLU_DATA_OUT)
         self.assertEquals(len(diffs), 2)
         self.assertTrue("Created on " in diffs[0])
     finally:
         silent_remove(GLU_DATA_OUT, disable=DISABLE_REMOVE)
Esempio n. 2
0
 def testFileList(self):
     try:
         silent_remove(GLU_DATA_OUT)
         test_input = ["-c", MULT_FILE_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue(
                 "tests/test_data/cp2k2data/glu_2.5_1.0.out energy: -283.342271788704181"
                 in output)
             self.assertTrue(
                 "tests/test_data/cp2k2data/glu_3.0_1.075.out energy: -472.455097972129295"
                 in output)
         diffs = diff_lines(GLU_DATA_OUT, GOOD_GLU_DATA_OUT)
         diffs1 = diff_lines(GLU_DATA_OUT2, GOOD_GLU_DATA_OUT2)
         for diff_list in [diffs, diffs1]:
             self.assertEquals(len(diff_list), 2)
             self.assertTrue("Created on " in diff_list[0])
     finally:
         silent_remove(GLU_DATA_OUT, disable=DISABLE_REMOVE)
         silent_remove(GLU_DATA_OUT2, disable=DISABLE_REMOVE)
Esempio n. 3
0
 def testMissingKey(self):
     test_input = ["-c", MISSING_KEY_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Missing config val" in output)
Esempio n. 4
0
 def testNoFiles(self):
     test_input = ["-c", NO_FILES_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Found no file names to process" in output)
Esempio n. 5
0
 def testTooManyAtoms(self):
     test_input = ["-c", TOO_MANY_CP2K_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("After reading" in output)
Esempio n. 6
0
 def testTooFewAtoms(self):
     test_input = ["-c", TOO_FEW_CP2K_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Expected to read coordinates" in output)
Esempio n. 7
0
 def testCutoffCP2KOutput(self):
     test_input = ["-c", CUTOFF_CP2K_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("Did not read coordinates" in output)
Esempio n. 8
0
 def testMissingTemplateFile(self):
     test_input = ["-c", MISSING_TEMPLATE_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertTrue("No such file or directory" in output)