コード例 #1
0
 def testHelp(self):
     test_input = ['-h']
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, test_input) as output:
         self.assertFalse(output)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments" in output)
コード例 #2
0
 def testNoArgsIni(self):
     test_input = []
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stdout(main, test_input) as output:
         self.assertTrue("optional arguments:" in output)
     with capture_stderr(main, test_input) as output:
         self.assertTrue(
             "Problems reading file: Could not read file" in output)
コード例 #3
0
 def testRelativeEnergy(self):
     try:
         test_input = ["-c", REL_E_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("44.822" in output)
         self.assertFalse(diff_lines(REL_E_OUT, GOOD_REL_E_OUT))
     finally:
         silent_remove(REL_E_OUT, disable=DISABLE_REMOVE)
コード例 #4
0
 def testCheckCharge(self):
     try:
         test_input = ["-c", CHECK_CHARGE_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertFalse("total charge" in output)
     finally:
         silent_remove(VMD_OUT, disable=DISABLE_REMOVE)
         silent_remove(WATER_OUT, disable=DISABLE_REMOVE)
コード例 #5
0
 def testGood(self):
     try:
         test_input = ["-c", DEF_INI]
         if logger.isEnabledFor(logging.DEBUG):
             main(test_input)
         with capture_stdout(main, test_input) as output:
             self.assertTrue("total charge" in output)
         self.assertFalse(diff_lines(VMD_OUT, GOOD_VMD_OUT))
         self.assertFalse(diff_lines(WATER_OUT, GOOD_WATER_OUT))
     finally:
         silent_remove(VMD_OUT)
         silent_remove(WATER_OUT)
コード例 #6
0
 def testMissingInfo(self):
     test_input = ["-c", MISSING_KEY_INI]
     if logger.isEnabledFor(logging.DEBUG):
         main(test_input)
     with capture_stderr(main, ["-c", test_input]) as output:
         self.assertTrue("Missing config val" in output)