Best Python code snippet using autotest_python
monitor_db_unittest.py
Source:monitor_db_unittest.py
...266 self._run_scheduler()267 self._assert_job_scheduled_on(2, 1)268 self._check_for_extra_schedulings()269# TODO: Revive this test.270# def test_HostScheduler_get_host_atomic_group_id(self):271# job = self._create_job(metahosts=[self.label6.id])272# queue_entry = scheduler_models.HostQueueEntry.fetch(273# where='job_id=%d' % job.id)[0]274# # Indirectly initialize the internal state of the host scheduler.275# self._dispatcher._refresh_pending_queue_entries()276#277# # Test the host scheduler278# host_scheduler = self._dispatcher._host_scheduler279#280#281# # Two labels each in a different atomic group. This should log an282# # error and continue.283# orig_logging_error = logging.error284# def mock_logging_error(message, *args):285# mock_logging_error._num_calls += 1286# # Test the logging call itself, we just wrapped it to count it.287# orig_logging_error(message, *args)288# mock_logging_error._num_calls = 0289# self.god.stub_with(logging, 'error', mock_logging_error)290# host_scheduler.refresh([])291# self.assertNotEquals(None, host_scheduler._get_host_atomic_group_id(292# [self.label4.id, self.label8.id], queue_entry))293# self.assertTrue(mock_logging_error._num_calls > 0)294# self.god.unstub(logging, 'error')295#296# # Two labels both in the same atomic group, this should not raise an297# # error, it will merely cause the job to schedule on the intersection.298# self.assertEquals(1, host_scheduler._get_host_atomic_group_id(299# [self.label4.id, self.label5.id]))300#301# self.assertEquals(None, host_scheduler._get_host_atomic_group_id([]))302# self.assertEquals(None, host_scheduler._get_host_atomic_group_id(303# [self.label3.id, self.label7.id, self.label6.id]))304# self.assertEquals(1, host_scheduler._get_host_atomic_group_id(305# [self.label4.id, self.label7.id, self.label6.id]))306# self.assertEquals(1, host_scheduler._get_host_atomic_group_id(307# [self.label7.id, self.label5.id]))308 def test_no_execution_subdir_not_found(self):309 """Reproduce bug crosbug.com/334353 and recover from it."""310 global_config.global_config.override_config_value(311 'SCHEDULER', 'drones', 'localhost')312 job = self._create_job(hostless=True)313 # Ensure execution_subdir is set before status314 original_set_status = scheduler_models.HostQueueEntry.set_status315 def fake_set_status(hqe, *args, **kwargs):316 self.assertEqual(hqe.execution_subdir, 'hostless')317 original_set_status(hqe, *args, **kwargs)318 self.god.stub_with(scheduler_models.HostQueueEntry, 'set_status',319 fake_set_status)320 self._dispatcher._schedule_new_jobs()...
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!!