Esempio n. 1
0
 def testValidGromacsVersionsAccepted(self):
     for opt in _SUPPORTED_GMX_VERSIONS:
         checkArgs(
             parseArgs([
                 "generate", "--gmx_version", opt, "--cpu_ids", 0,
                 "--gpu_ids", 0, "--run_file", "test.sh"
             ]))
Esempio n. 2
0
def gromax():
    logger: logging.Logger = logging.getLogger("gromax")
    parsed_args: argparse.Namespace = parseArgs(sys.argv[1:])
    _setLoggingLevel(logger, parsed_args.log_level)
    checkArgs(parsed_args)
    logger.info("Executing gromax.")
    workflow: Callable[[argparse.Namespace],
                       None] = _selectWorkflow(parsed_args)
    workflow(parsed_args)
    sys.exit(0)
Esempio n. 3
0
 def testInvalidGromacsVersionCaught(self):
     args = ["generate", "--gmx_version", "2015"]
     with self.assertRaises(SystemExit):
         checkArgs(parseArgs(args))
Esempio n. 4
0
 def testBothGpuOptionsSelected(self):
     self.args.extend(
         ["--cpu_ids", "0", "--gpu_ids", "0", "--num_gpus", "4"])
     with self.assertRaises(SystemExit) as sysexit:
         checkArgs(parseArgs(self.args))
     self.assertGreater(sysexit.exception.code, 0)
Esempio n. 5
0
 def testNeitherGpuOptionSelected(self):
     self.args.extend(["--cpu_ids", "0"])
     with self.assertRaises(SystemExit) as sysexit:
         checkArgs(parseArgs(self.args))
     self.assertGreater(sysexit.exception.code, 0)
Esempio n. 6
0
 def testInvalidModeCaught(self):
     with self.assertRaises(SystemExit) as sysexit:
         checkArgs(parseArgs(["some_command"]))
     self.assertGreater(sysexit.exception.code, 0)
Esempio n. 7
0
 def testExitsWithVersion(self):
     with self.assertRaises(SystemExit) as sysexit:
         parseArgs(["--version"])
     self.assertEqual(sysexit.exception.code, 0)