async def run_xctest( self, test_bundle_id: str, app_bundle_id: str, test_host_app_bundle_id: Optional[str] = None, is_ui_test: bool = False, is_logic_test: bool = False, tests_to_run: Optional[Set[str]] = None, tests_to_skip: Optional[Set[str]] = None, env: Optional[Dict[str, str]] = None, args: Optional[List[str]] = None, result_bundle_path: Optional[str] = None, idb_log_buffer: Optional[StringIO] = None, timeout: Optional[int] = None, poll_interval_sec: float = TESTS_POLL_INTERVAL, ) -> AsyncIterator[TestRunInfo]: async with self.stub.xctest_run.open() as stream: request = make_request( test_bundle_id=test_bundle_id, app_bundle_id=app_bundle_id, test_host_app_bundle_id=test_host_app_bundle_id, is_ui_test=is_ui_test, is_logic_test=is_logic_test, tests_to_run=tests_to_run, tests_to_skip=tests_to_skip, env=env, args=args, result_bundle_path=result_bundle_path, timeout=timeout, ) await stream.send_message(request) await stream.end() async for response in stream: # response.log_output is a container of strings. # google.protobuf.pyext._message.RepeatedScalarContainer. for line in [ line for lines in response.log_output for line in lines.splitlines(keepends=True) ]: self._log_from_companion(line) if idb_log_buffer: idb_log_buffer.write(line) if result_bundle_path: await write_result_bundle( response=response, output_path=result_bundle_path, logger=self.logger, ) for result in make_results(response): yield result
async def run_xctest( self, test_bundle_id: str, app_bundle_id: str, test_host_app_bundle_id: Optional[str] = None, is_ui_test: bool = False, is_logic_test: bool = False, tests_to_run: Optional[Set[str]] = None, tests_to_skip: Optional[Set[str]] = None, env: Optional[Dict[str, str]] = None, args: Optional[List[str]] = None, result_bundle_path: Optional[str] = None, idb_log_buffer: Optional[StringIO] = None, timeout: Optional[int] = None, poll_interval_sec: float = TESTS_POLL_INTERVAL, report_activities: bool = False, report_attachments: bool = False, activities_output_path: Optional[str] = None, coverage_output_path: Optional[str] = None, ) -> AsyncIterator[TestRunInfo]: async with self.stub.xctest_run.open() as stream: request = make_request( test_bundle_id=test_bundle_id, app_bundle_id=app_bundle_id, test_host_app_bundle_id=test_host_app_bundle_id, is_ui_test=is_ui_test, is_logic_test=is_logic_test, tests_to_run=tests_to_run, tests_to_skip=tests_to_skip, env=env, args=args, result_bundle_path=result_bundle_path, timeout=timeout, report_activities=(report_activities or activities_output_path is not None or report_attachments), report_attachments=report_attachments, collect_coverage=coverage_output_path is not None, ) log_parser = XCTestLogParser() await stream.send_message(request) await stream.end() async for response in stream: # response.log_output is a container of strings. # google.protobuf.pyext._message.RepeatedScalarContainer. for line in [ line for lines in response.log_output for line in lines.splitlines(keepends=True) ]: log_parser.parse_streaming_log(line.rstrip()) self._log_from_companion(line) if idb_log_buffer: idb_log_buffer.write(line) if result_bundle_path: await write_result_bundle( response=response, output_path=result_bundle_path, logger=self.logger, ) if response.coverage_json and coverage_output_path: with open(coverage_output_path, "w") as f: f.write(response.coverage_json) for result in make_results(response, log_parser): if activities_output_path: save_attachments( run_info=result, activities_output_path=activities_output_path, ) yield result