fixtures.py 382 B

123456789101112131415
  1. import pytest
  2. from ckanext.archiver.tests.mock_flask_server import create_app
  3. import threading
  4. @pytest.fixture(scope='session', autouse=True)
  5. def client():
  6. app = create_app()
  7. port = 9091
  8. thread = threading.Thread(target=lambda: app.run(debug=True, port=port, use_reloader=False))
  9. thread.daemon = True
  10. thread.start()
  11. yield "http://127.0.0.1:" + str(port)