(args, tests)
| 1104 | |
| 1105 | |
| 1106 | def _extract(args, tests): |
| 1107 | if not tests: |
| 1108 | return 0 # No selected tests |
| 1109 | |
| 1110 | if not args.zipfile_path: |
| 1111 | raise "Missing required archive path" |
| 1112 | |
| 1113 | if not os.path.isfile(args.zipfile_path): |
| 1114 | raise "Input archive path is invalid" |
| 1115 | |
| 1116 | archive_name = os.path.basename(args.zipfile_path) |
| 1117 | pos = archive_name.find('.') |
| 1118 | if pos >= 0: |
| 1119 | archive_name = archive_name[:pos] |
| 1120 | log(f'archive-name: {archive_name}') |
| 1121 | |
| 1122 | manager = multiprocessing.Manager() |
| 1123 | queue = manager.Queue() |
| 1124 | for name, filepath in tests.items(): |
| 1125 | queue.put((name, filepath)) |
| 1126 | |
| 1127 | if args.jobs == 0: |
| 1128 | results = _extract_worker((args.zipfile_path, archive_name, queue)) |
| 1129 | else: |
| 1130 | with multiprocessing.Pool(processes=args.jobs) as pool: |
| 1131 | results = pool.map(_extract_worker, [(args.zipfile_path, archive_name, queue)] * args.jobs) |
| 1132 | |
| 1133 | return sum(results) |
| 1134 | |
| 1135 | |
| 1136 | def _main(): |
no test coverage detected