How to use _run_a_few_cycles method in autotest

Best Python code snippet using autotest_python

monitor_db_unittest.py

Source:monitor_db_unittest.py Github

copy

Full Screen

...571 fake_max_runnable_processes)572 def _setup_some_agents(self, num_agents):573 self._agents = [DummyAgent() for i in xrange(num_agents)]574 self._dispatcher._agents = list(self._agents)575 def _run_a_few_cycles(self):576 for i in xrange(4):577 self._dispatcher._handle_agents()578 def _assert_agents_started(self, indexes, is_started=True):579 for i in indexes:580 self.assert_(self._agents[i].started == is_started,581 'Agent %d %sstarted' %582 (i, is_started and 'not ' or ''))583 def _assert_agents_not_started(self, indexes):584 self._assert_agents_started(indexes, False)585 def test_throttle_total(self):586 self._setup_some_agents(4)587 self._run_a_few_cycles()588 self._assert_agents_started([0, 1, 2])589 self._assert_agents_not_started([3])590 def test_throttle_per_cycle(self):591 self._setup_some_agents(3)592 self._dispatcher._handle_agents()593 self._assert_agents_started([0, 1])594 self._assert_agents_not_started([2])595 def test_throttle_with_synchronous(self):596 self._setup_some_agents(2)597 self._agents[0].task.num_processes = 3598 self._run_a_few_cycles()599 self._assert_agents_started([0])600 self._assert_agents_not_started([1])601 def test_large_agent_starvation(self):602 """603 Ensure large agents don't get starved by lower-priority agents.604 """605 self._setup_some_agents(3)606 self._agents[1].task.num_processes = 3607 self._run_a_few_cycles()608 self._assert_agents_started([0])609 self._assert_agents_not_started([1, 2])610 self._agents[0].set_done(True)611 self._run_a_few_cycles()612 self._assert_agents_started([1])613 self._assert_agents_not_started([2])614 def test_zero_process_agent(self):615 self._setup_some_agents(5)616 self._agents[4].task.num_processes = 0617 self._run_a_few_cycles()618 self._assert_agents_started([0, 1, 2, 4])619 self._assert_agents_not_started([3])620class PidfileRunMonitorTest(unittest.TestCase):621 execution_tag = 'test_tag'622 pid = 12345623 process = drone_manager.Process('myhost', pid)624 num_tests_failed = 1625 def setUp(self):626 self.god = mock.mock_god()627 self.mock_drone_manager = self.god.create_mock_class(628 drone_manager.DroneManager, 'drone_manager')629 self.god.stub_with(monitor_db, '_drone_manager',630 self.mock_drone_manager)631 self.god.stub_function(mail.manager, 'enqueue_admin')...

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