def _compression(self): iblrig_pipeline.compress_video(self.server_folder) # Check for deletion of compress_video.flag cflags = list(self.server_folder.rglob('compress_video.flag')) self.assertTrue(cflags == []) # Check for creation of register_me.flag rflags = list(self.server_folder.rglob('register_me.flag')) self.assertTrue(rflags != []) # Check for flag in all sessions self.assertTrue(len(rflags) == len(self.vidfiles))
def test_empty_flag_file(self): with tempfile.TemporaryDirectory() as tdir: flag = Path(tdir).joinpath('compress_video.flag') flag.touch() experimental_data.compress_video(tdir, dry=True) self.assertFalse(flag.exists())
parser = argparse.ArgumentParser(description="Description of your program") parser.add_argument("action", help="Action: " + ",".join(ALLOWED_ACTIONS)) parser.add_argument("folder", help="A Folder containing a session") parser.add_argument("--dry", help="Dry Run", required=False, default=False, type=str) parser.add_argument( "--count", help="Max number of sessions to run this on", required=False, default=False, type=int, ) args = parser.parse_args( ) # returns data from the options specified (echo) if args.dry and args.dry.lower() == "false": args.dry = False assert Path(args.folder).exists() if args.action == "extract": extract(args.folder, dry=args.dry) elif args.action == "register": register(args.folder, dry=args.dry) elif args.action == "create": create(args.folder, dry=args.dry) elif args.action == "compress_video": compress_video(args.folder, dry=args.dry, max_sessions=args.count) else: logger.error("Allowed actions are: " + ", ".join(ALLOWED_ACTIONS))