How to use schedule_metahost method in autotest

Best Python code snippet using autotest_python

metahost_scheduler_unittest.py

Source:metahost_scheduler_unittest.py Github

copy

Full Screen

...18 self.god.unstub_all()19 def entry(self):20 return self.god.create_mock_class(scheduler_models.HostQueueEntry,21 'entry')22 def test_can_schedule_metahost(self):23 entry = self.entry()24 entry.meta_host = None25 self.assertFalse(self.metahost_scheduler.can_schedule_metahost(entry))26 entry.meta_host = 127 self.assert_(self.metahost_scheduler.can_schedule_metahost(entry))28 def test_schedule_metahost(self):29 entry = self.entry()30 entry.meta_host = 131 host = object()32 self.scheduling_utility.hosts_in_label.expect_call(1).and_return(33 [2, 3, 4, 5])34 # 2 is in ineligible_hosts35 (self.scheduling_utility.ineligible_hosts_for_entry.expect_call(entry)36 .and_return([2]))37 self.scheduling_utility.is_host_usable.expect_call(2).and_return(True)38 # 3 is unusable39 self.scheduling_utility.is_host_usable.expect_call(3).and_return(False)40 self.scheduling_utility.remove_host_from_label.expect_call(3, 1)41 # 4 is ineligible for the job42 self.scheduling_utility.is_host_usable.expect_call(4).and_return(True)43 (self.scheduling_utility.is_host_eligible_for_job.expect_call(4, entry)44 .and_return(False))45 # 5 runs46 self.scheduling_utility.is_host_usable.expect_call(5).and_return(True)47 (self.scheduling_utility.is_host_eligible_for_job.expect_call(5, entry)48 .and_return(True))49 self.scheduling_utility.remove_host_from_label.expect_call(5, 1)50 self.scheduling_utility.pop_host.expect_call(5).and_return(host)51 entry.set_host.expect_call(host)52 self.metahost_scheduler.schedule_metahost(entry,53 self.scheduling_utility)54 self.god.check_playback()55 def test_no_hosts(self):56 entry = self.entry()57 entry.meta_host = 158 self.scheduling_utility.hosts_in_label.expect_call(1).and_return(())59 (self.scheduling_utility.ineligible_hosts_for_entry.expect_call(entry)60 .and_return(()))61 self.metahost_scheduler.schedule_metahost(entry,62 self.scheduling_utility)63 self.god.check_playback()64if __name__ == '__main__':...

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 autotest 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