conftest.py 503 B

1234567891011121314151617181920212223
  1. import os
  2. import pytest
  3. from flask import Flask
  4. # Getting the absolute path of the current file's directory
  5. ABS_PATH = os.path.dirname(os.path.abspath(__file__))
  6. # Getting the absolute path of the project's root directory
  7. PROJECT_DIR = os.path.abspath(os.path.join(ABS_PATH, os.pardir, os.pardir))
  8. CACHED_APP = Flask(__name__)
  9. @pytest.fixture
  10. def app() -> Flask:
  11. return CACHED_APP
  12. @pytest.fixture(autouse=True)
  13. def _provide_app_context(app: Flask):
  14. with app.app_context():
  15. yield