Best Python code snippet using autotest_python
monitor_db_functional_test.py
Source:monitor_db_functional_test.py  
...797        self._check_host_status(self.hosts[0], HostStatus.REPAIRING)798        self.mock_drone_manager.finish_process(_PidfileType.VERIFY)799        self._run_dispatcher()800        self._check_statuses(entry, HqeStatus.RUNNING, HostStatus.RUNNING)801    def test_hostless_job(self):802        job = self._create_job(hostless=True)803        entry = job.hostqueueentry_set.all()[0]804        self._run_dispatcher()805        self._check_entry_status(entry, HqeStatus.RUNNING)806        self.mock_drone_manager.finish_process(_PidfileType.JOB)807        self._run_dispatcher()808        self._check_entry_status(entry, HqeStatus.PARSING)809        self.mock_drone_manager.finish_process(_PidfileType.PARSE)810        self._run_dispatcher()811        self._check_entry_status(entry, HqeStatus.COMPLETED)812    def test_pre_job_keyvals(self):813        job = self._create_job(hosts=[1])814        job.run_verify = False815        job.run_reset = False816        job.reboot_before = model_attributes.RebootBefore.NEVER817        job.save()818        models.JobKeyval.objects.create(job=job, key='mykey', value='myvalue')819        self._run_dispatcher()820        self._finish_job(job.hostqueueentry_set.all()[0])821        attached_files = self.mock_drone_manager.attached_files(822                '1-autotest_system/host1')823        job_keyval_path = '1-autotest_system/host1/keyval'824        self.assert_(job_keyval_path in attached_files, attached_files)825        keyval_contents = attached_files[job_keyval_path]826        keyval_dict = dict(line.strip().split('=', 1)827                           for line in keyval_contents.splitlines())828        self.assert_('job_queued' in keyval_dict, keyval_dict)829        self.assertEquals(keyval_dict['mykey'], 'myvalue')830# This tests the scheduler functions with archiving step disabled831class SchedulerFunctionalTestNoArchiving(SchedulerFunctionalTest):832    def _set_global_config_values(self):833        super(SchedulerFunctionalTestNoArchiving, self834                )._set_global_config_values()835        self.mock_config.set_config_value('SCHEDULER', 'enable_archiving',836                                          False)837    def _finish_parsing(self):838        self.mock_drone_manager.finish_process(_PidfileType.PARSE)839        self._run_dispatcher()840    def _run_post_job_cleanup_failure_up_to_repair(self, queue_entry,841                                                   include_verify=True):842        if include_verify:843            self._run_pre_job_verify(queue_entry)844        self._run_dispatcher() # job845        self.mock_drone_manager.finish_process(_PidfileType.JOB)846        self._run_dispatcher() # parsing + cleanup847        self.mock_drone_manager.finish_process(_PidfileType.PARSE)848        self.mock_drone_manager.finish_process(_PidfileType.CLEANUP,849                                               exit_status=256)850        self._run_dispatcher() # repair, HQE unaffected851        return queue_entry852    def test_hostless_job(self):853        job = self._create_job(hostless=True)854        entry = job.hostqueueentry_set.all()[0]855        self._run_dispatcher()856        self._check_entry_status(entry, HqeStatus.RUNNING)857        self.mock_drone_manager.finish_process(_PidfileType.JOB)858        self._run_dispatcher()859        self._check_entry_status(entry, HqeStatus.PARSING)860        self.mock_drone_manager.finish_process(_PidfileType.PARSE)861        self._run_dispatcher()862        self._check_entry_status(entry, HqeStatus.COMPLETED)863    def test_synchronous_with_reset(self):864        # For crbug/621257.865        job = self._create_job(hosts=[1, 2])866        job.synch_count = 2...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!!
