Best Python code snippet using tappy_python
tracker.py
Source:tracker.py
...32 else: # pragma: no cover33 self._sanitized_table = str.maketrans(' \\/\n', '----')34 def _get_outdir(self):35 return self._outdir36 def _set_outdir(self, outdir):37 self._outdir = outdir38 if outdir and not os.path.exists(outdir):39 os.makedirs(outdir)40 outdir = property(_get_outdir, _set_outdir)41 def _track(self, class_name):42 """Keep track of which test cases have executed."""43 if self._test_cases.get(class_name) is None:44 if self.streaming and self.header:45 self._write_test_case_header(class_name, self.stream)46 self._test_cases[class_name] = []47 if self.combined:48 self.combined_test_cases_seen.append(class_name)49 def add_ok(self, class_name, description, directive=''):50 result = Result(...
igv.py
Source:igv.py
...59 self.port = port or 6015160 self.commands = []61 self._connect()62 if outdir:63 self._set_outdir(outdir)64 def _connect(self):65 if self._socket:66 self._socket.close()67 self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)68 self._socket.connect((self.host, self.port))69 def close(self):70 self._socket.close()71 def __enter__(self):72 return self73 def __exit__(self, exc_type, exc_value, traceback):74 self.close()75 def _set_outdir(self, outdir):76 outdir = os.path.abspath(outdir)77 if not os.path.exists(outdir):78 os.makedirs(outdir)79 logging.info('Created %s', outdir)80 self.send('snapshotDirectory %s' % outdir)81 self._outdir = outdir82 def send(self, cmd):83 logging.info('cmd: %s', cmd)84 self.commands.append(cmd)85 self._socket.send(cmd + '\n')86 return self._socket.recv(4096).rstrip('\n')87 def save(self, path=None):88 """ .png, .jpg, or .svg89 """90 if self._outdir is None:91 self._set_outdir(os.curdir)92 if path is not None:93 # igv assumes the path is just a single filename, but94 # we can set the snapshot dir. then just use the filename.95 dirname = os.path.dirname(path)96 dirname = os.path.abspath(dirname)97 org_dir = self._outdir98 if dirname != org_dir:99 self._set_outdir(dirname)100 status = self.send('snapshot ' + os.path.basename(path))101 if org_dir is not None and org_dir != dirname:102 self._set_outdir(org_dir)103 return status104 else:105 return self.send('snapshot')106 snapshot = save107 def new(self):108 return self.send('new')109 def genome(self, name):110 return self.send('genome {0}'.format(name))111 def load(self, url):112 return self.send('load {0}'.format(url))113 def goto(self, *loci):114 if not loci:115 loci = ['all']116 return self.send('goto {0}'.format(' '.join(map(str, loci))))...
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!!