How to use make_listfile method in stestr

Best Python code snippet using stestr_python

test_processor.py

Source:test_processor.py Github

copy

Full Screen

...137 self.test_ids, exclude_list=self.exclude_list,138 include_list=self.include_list,139 regexes=self.test_filters,140 exclude_regex=self.exclude_regex)141 name = self.make_listfile()142 variables['IDFILE'] = name143 idlist = ' '.join(self.test_ids)144 variables['IDLIST'] = idlist145 def subst(match):146 return variables.get(match.groups(1)[0], '')147 if self.test_ids is None:148 # No test ids, no id option.149 idoption = ''150 else:151 idoption = re.sub(variable_regex, subst, self.idoption)152 variables['IDOPTION'] = idoption153 self.cmd = re.sub(variable_regex, subst, cmd)154 def make_listfile(self):155 name = None156 try:157 if self._listpath:158 name = self._listpath159 stream = open(name, 'wb')160 else:161 fd, name = tempfile.mkstemp()162 stream = os.fdopen(fd, 'wb')163 with stream:164 self.list_file_name = name165 testlist.write_list(stream, self.test_ids)166 except Exception:167 if name:168 os.unlink(name)...

Full Screen

Full Screen

zrank.py

Source:zrank.py Github

copy

Full Screen

...13 LOCAL = ["zrank"]14 def rank(self, complex_path, refinement=False, retry_with_protonatation=True):15 if not isinstance(complex_path, (list, tuple)):16 complex_path = [complex_path]17 listfile = self.make_listfile(complex_path)18 try:19 self(list_file=list_file, refinement=refinement)20 except (SystemExit, KeyboardInterrupt):21 raise22 except Exception as e:23 pdb2pqr = Pdb2pqr(work_dir=self.work_dir, job=self.job)24 if retry_with_protonatation:25 protonated_complex_file = pdb2pqr.debump_add_h(complex_path)26 listfile = self.make_listfile(protonated_complex_file)27 self(list_file=list_file, refinement=refinement)28 assert os.path.isfile(listfile+".zr.out"), "No output for zrank"29 with open(listfile+".zr.out") as f:30 scores = dict(line.rstrip().split() for line in f)31 if len(complex_path) == 1:32 scores = list(scores.values())[0]33 safe_remove((listfile, listfile.name+".zr.out"))34 return scores35 def make_listfile(self, complex_path):36 listfile = tempfile.NamedTemporaryFile(dir=work_dir, prefix="listfile", suffix=".txt", delete=False)37 for pdb in complex_path:38 print(os.path.basename(pdb), file=listfile)39 listfile.close()40 return listfile.name41# def run_zrank(complex_path, refinement=False, retry_with_protonatation=True,42# work_dir=None, docker=True, job=None):43# if work_dir is None:44# work_dir = os.getcwd()45#46# _parameters = ["-R"] if refinement else []47#48# if not isinstance(complex_path, (list, tuple)):49# complex_path = [complex_path]...

Full Screen

Full Screen

makelist.py

Source:makelist.py Github

copy

Full Screen

...13import datetime14import numpy as np15import logging16logger = logging.getLogger(__name__)17def make_listfile(appdir, outname, outthread):18 outf = open(outname,'w')19 namepat = '([^_]*)_.*_(\d+)x(\d+)_.*'20 for dirpath, dnames, fnames in os.walk(appdir):21 for f in fnames:22 if f.endswith('.likelihood'):23 basename = f[:f.rfind('.')]24 #extract the <trainer, node, thread> from f25 m = re.search(namepat, f)26 if m:27 trainer = m.group(1)28 node = m.group(2)29 thread = m.group(3)30 if outthread:31 outf.write('%s %s %s\n'%(basename, trainer, thread)) 32 else:33 outf.write('%s %s %s\n'%(basename, trainer, node)) 34if __name__ == "__main__":35 program = os.path.basename(sys.argv[0])36 logger = logging.getLogger(program)37 # logging configure38 import logging.config39 logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s')40 logging.root.setLevel(level=logging.DEBUG)41 logger.info("running %s" % ' '.join(sys.argv))42 # check and process input arguments43 if len(sys.argv) < 3:44 logger.error(globals()['__doc__'] % locals())45 sys.exit(1)46 # check the path47 logdir = sys.argv[1]48 outname = sys.argv[2]49 outthread = True if sys.argv[3]=='thread' else False...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run stestr automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful