def test_timeout_error_on_too_long_service_stop(): unstoppable_service_path = os.path.join(os.path.dirname(__file__), 'unstoppable_service.py') service = HttpService([sys.executable, unstoppable_service_path, '{port}']) service.start() try: with pytest.raises(subprocess.TimeoutExpired): service.stop(0.001) finally: # cleanup by ending the service process service._service_proc.terminate()
def das_session(vcap_services, uaa_imposter): waitress_path = os.path.join(os.path.dirname(sys.executable), 'waitress-serve') das_command = [ waitress_path, '--port', '{port}', '--call', 'data_acquisition.app:get_app'] project_root_path = os.path.join(waitress_path, '../../../..') das_service = HttpService( das_command, env={ 'VCAP_APPLICATION': TEST_VCAP_APPLICATION, 'VCAP_SERVICES': vcap_services, 'VCAP_APP_PORT': '{port}', 'PYTHONPATH': project_root_path}) das_service.start() yield das_service das_service.stop()
def das_session(vcap_services, uaa_imposter): waitress_path = os.path.join(os.path.dirname(sys.executable), 'waitress-serve') das_command = [ waitress_path, '--port', '{port}', '--call', 'data_acquisition.app:get_app' ] project_root_path = os.path.join(waitress_path, '../../../..') das_service = HttpService(das_command, env={ 'VCAP_APPLICATION': TEST_VCAP_APPLICATION, 'VCAP_SERVICES': vcap_services, 'VCAP_APP_PORT': '{port}', 'PYTHONPATH': project_root_path }) das_service.start() yield das_service das_service.stop()