Best Python code snippet using autotest_python
app_svc.py
Source:app_svc.py
...106 async def teardown(self):107 await self._destroy_plugins()108 await self._save_configurations()109 await self._services.get('data_svc').save_state()110 await self._write_reports()111 self.log.debug('[!] shutting down server...good-bye')112 async def register_contacts(self):113 contact_svc = self.get_service('contact_svc')114 await contact_svc.register(Http(self.get_services()))115 await contact_svc.register(Udp(self.get_services()))116 await contact_svc.register(Tcp(self.get_services()))117 await contact_svc.register(WebSocket(self.get_services()))118 await contact_svc.register(Html(self.get_services()))119 """ PRIVATE """120 async def _save_configurations(self):121 for cfg in ['default', 'agents']:122 with open('conf/%s.yml' % cfg, 'w') as config:123 config.write(yaml.dump(self.get_config(name=cfg)))124 async def _destroy_plugins(self):125 for plugin in await self._services.get('data_svc').locate('plugins', dict(enabled=True)):126 await plugin.destroy(self.get_services())127 async def _write_reports(self):128 file_svc = self.get_service('file_svc')129 r_dir = await file_svc.create_exfil_sub_directory('%s/reports' % self.get_config('reports_dir'))130 report = json.dumps(dict(self.get_service('contact_svc').report)).encode()131 await file_svc.save_file('contact_reports', report, r_dir)132 for op in await self.get_service('data_svc').locate('operations'):133 report = json.dumps(op.report(self.get_service('file_svc')))...
mlst_reporter.py
Source:mlst_reporter.py
...59 self.any_allele_unsure = True60 allele_str += '*'61 details_list = [str(results[x]) for x in ['cov', 'pc', 'ctgs', 'depth', 'hetmin', 'hets']]62 return allele_str, '\t'.join(details_list)63 def _write_reports(self):64 f_out_all = pyfastaq.utils.open_file_write(self.outprefix + '.details.tsv')65 print('gene\tallele\tcov\tpc\tctgs\tdepth\thetmin\thets', file=f_out_all)66 out_simple = [str(self.sequence_type)]67 for gene in self.mlst_profile.genes_list:68 allele_str, detail_str = self._report_strings(self.gene_results[gene])69 out_simple.append(allele_str)70 print(gene, allele_str, detail_str, sep='\t', file=f_out_all)71 pyfastaq.utils.close(f_out_all)72 if self.sequence_type != 'ND' and self.any_allele_unsure:73 out_simple[0] += '*'74 f_out_simple = pyfastaq.utils.open_file_write(self.outprefix + '.tsv')75 print('ST', *self.mlst_profile.genes_list, sep='\t', file=f_out_simple)76 print(*out_simple, sep='\t', file=f_out_simple)77 pyfastaq.utils.close(f_out_simple)78 def run(self):79 self.summary_sample.run()80 self._call_genes()81 self._call_sequence_type()...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!