Best Python code snippet using autotest_python
monitor_db_functional_unittest.py
Source:monitor_db_functional_unittest.py  
...594        queue_entry.aborted = True595        queue_entry.save()596        self._initialize_test()597        self._run_dispatcher()598    def test_job_scheduled_just_after_abort(self):599        # test a pretty obscure corner case where a job is aborted while queued,600        # another job is ready to run, and throttling is active. the post-abort601        # cleanup must not be pre-empted by the second job.602        job1, queue_entry1 = self._make_job_and_queue_entry()603        job2, queue_entry2 = self._make_job_and_queue_entry()604        self.mock_drone_manager.process_capacity = 0605        self._run_dispatcher()  # schedule job1, but won't start verify606        job1.hostqueueentry_set.update(aborted=True)607        self.mock_drone_manager.process_capacity = 100608        self._run_dispatcher()  # cleanup must run here, not verify for job2609        self._check_statuses(queue_entry1, HqeStatus.ABORTED,610                             HostStatus.CLEANING)611        self.mock_drone_manager.finish_process(_PidfileType.CLEANUP)612        self._run_dispatcher()  # now verify starts for job2...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!!
