示例#1
0
def main():
    args = ManifestsArgs()
    console.configure(level=args.logging_level)

    if args.action == "list":
        for klass in args.manifests:
            for manifest in klass().values():
                logging.info(f"{manifest.build.name} {manifest.build.version}")
    elif args.action == "update":
        for klass in args.manifests:
            klass().update(keep=args.keep)

    logging.info("Done.")
 def test_keep_true(self):
     self.assertTrue(ManifestsArgs().keep)
 def test_keep_default(self):
     self.assertFalse(ManifestsArgs().keep)
 def test_verbose_true(self):
     self.assertTrue(ManifestsArgs().logging_level, logging.DEBUG)
 def test_verbose_default(self):
     self.assertTrue(ManifestsArgs().logging_level, logging.INFO)
 def test_action_invalid(self):
     with self.assertRaises(SystemExit):
         self.assertEqual(ManifestsArgs().action, "invalid")
 def test_action_update(self):
     self.assertEqual(ManifestsArgs().action, "update")
 def test_action_list(self):
     self.assertEqual(ManifestsArgs().action, "list")