def _watchPidWrapper(): "PID attachment monitor" try: if utils.isProcessRunning(source_pid): Timer(1, _watchPidWrapper).start() else: _logger.warning("Process %d is not running anymore", source_pid) utils.terminateProcess(target_pid) except (TypeError, AttributeError): # pragma: no cover return
def test(): startCodeCheckerServer() # Ensure the server is active reply = requests.post(it._url + '/get_diagnose_info', data={'project_file' : 'some_project'}) it.assertTrue(reply.ok) # Send a request to the shutdown addr with it.assertRaises(requests.ConnectionError): reply = requests.post(it._url + '/shutdown') it._server.terminate() utils.terminateProcess(it._server.pid)
def shutdownServer(): """ Terminates the current process to shutdown the server """ _logger.info("Shutting down server") utils.terminateProcess(os.getpid())
def teardown(): it._server.terminate() utils.terminateProcess(it._server.pid)