Best Python code snippet using locust
test_scripts_stop.py
Source:test_scripts_stop.py
...67 mocked_kill.assert_has_calls([mock.call(self.PID, signal.SIGTERM),68 mock.call(self.PID, 0)])69 self.assertStdoutEqual("worker process {0} is dead\n".format(self.PID))70 @compat.skipUnlessPlatformIs("posix")71 def test_stop_timeout(self):72 """73 test stopWorker() when stop timeouts74 """75 # patch open() to return a pid file76 self.setUpOpen(str(self.PID))77 # patch os.kill to emulate successful kill78 mocked_kill = mock.Mock()79 self.patch(os, "kill", mocked_kill)80 # don't waste time81 self.patch(time, "sleep", mock.Mock())82 # check that stopWorker() sends expected signal to right PID83 # and print correct message to stdout84 exit_code = stop.stopWorker(None, False)85 self.assertEqual(exit_code, 1)...
test_segmentation.py
Source:test_segmentation.py
...52 z_mask = int(abs(min_z) - abs(centroid_z))53 mask_value = patient_mask[z_mask, x_mask, y_mask]54 assert mask_value == 25555@pytest.mark.stop_timeout56def test_stop_timeout():57 timeout = get_timeout()58 if timeout > 0:59 time.sleep(timeout + 1)...
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!!