Best Python code snippet using autotest_python
test_database.py
Source:test_database.py
...251 # Get a fresh copy of the job from the database252 newjob = list(db._get_all_jobs_in_state('INCOMING'))[0]253 self.assertIsNot(job, newjob)254 self.assertEqual(newjob._metadata['runner_id'], 'new-SGE-ID')255 def test_get_job_dependencies(self):256 """Check Database._get_job_dependencies()"""257 db = MemoryDatabase(Job)258 db._connect(None)259 db._create_tables()260 self.assertEqual(db._get_job_dependencies(), {})261 c = db.conn.cursor()262 query = "INSERT INTO dependencies(child,parent) VALUES(?,?)"263 c.execute(query, ('foo', 'bar'))264 c.execute(query, ('a', 'one'))265 c.execute(query, ('a', 'two'))266 db.conn.commit()267 self.assertEqual(db._get_job_dependencies(),268 {'foo': ['bar'], 'a': ['one', 'two']})269if __name__ == '__main__':...
rdb_lib.py
Source:rdb_lib.py
...24 from autotest_lib.scheduler import query_managers25 self.query_manager = query_managers.AFEHostQueryManager()26 jobs = [queue_entry.job_id for queue_entry in queue_entries]27 self._job_acls = self.query_manager._get_job_acl_groups(jobs)28 self._job_deps = self.query_manager._get_job_dependencies(jobs)29 self._labels = self.query_manager._get_labels(self._job_deps)30 self._suite_min_duts = suite_min_duts or {}31 def get_job_info(self, queue_entry):32 """Extract job information from a queue_entry/host-scheduler.33 @param queue_entry: The queue_entry for which we need job information.34 @return: A dictionary representing job related information.35 """36 job_id = queue_entry.job_id37 job_deps, job_preferred_deps = [], []38 for dep in self._job_deps.get(job_id, []):39 if not provision.is_for_special_action(self._labels[dep].name):40 job_deps.append(dep)41 elif provision.Provision.acts_on(self._labels[dep].name):42 job_preferred_deps.append(dep)...
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!!