Best Python code snippet using localstack_python
test_http2_server.py
Source:test_http2_server.py
...23 LOG.info("%.2f waiting on server to shut down", time.time())24 thread.join(timeout=15)25 self.assertFalse(is_port_open(port), "port is still open after stop")26 LOG.info("%.2f port stopped %d", time.time(), port)27 def test_run_and_stop_server_from_different_threads(self):28 port = get_free_tcp_port()29 host = "127.0.0.1"30 LOG.info("%.2f starting server on port %d", time.time(), port)31 thread = run_server(port=port, bind_address=host, asynchronous=True)32 try:33 url = f"http://{host}:{port}"34 self.assertTrue(35 poll_condition(lambda: is_port_open(url, http_path="/"), timeout=15),36 "gave up waiting for port %d " % port,37 )38 finally:39 LOG.info("%.2f stopping server on port %d", time.time(), port)40 threading.Thread(target=thread.stop).start()41 LOG.info("%.2f waiting on server to shut down", time.time())...
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!!