2022-05-17 16:47:55 -04:00
|
|
|
"""Conftest."""
|
2022-05-19 14:38:47 -04:00
|
|
|
import os
|
|
|
|
|
2022-05-17 16:35:38 -04:00
|
|
|
import pytest
|
2022-05-18 12:18:47 -04:00
|
|
|
from flask.app import Flask
|
2022-05-17 16:47:55 -04:00
|
|
|
|
2022-05-20 11:46:44 -04:00
|
|
|
|
2022-06-01 11:17:25 -04:00
|
|
|
# We need to call this before importing spiffworkflow_backend
|
2022-05-20 11:46:44 -04:00
|
|
|
# otherwise typeguard cannot work. hence the noqa: E402
|
|
|
|
if os.environ.get("RUN_TYPEGUARD") == "true":
|
2022-05-20 11:55:09 -04:00
|
|
|
from typeguard.importhook import install_import_hook
|
|
|
|
|
2022-06-01 11:17:25 -04:00
|
|
|
install_import_hook(packages="spiffworkflow_backend")
|
2022-05-20 11:46:44 -04:00
|
|
|
|
|
|
|
|
2022-06-01 11:17:25 -04:00
|
|
|
from spiffworkflow_backend import create_app # noqa: E402
|
2022-05-17 16:35:38 -04:00
|
|
|
|
|
|
|
|
2022-05-17 16:47:55 -04:00
|
|
|
@pytest.fixture(scope="session")
|
2022-05-18 10:49:20 -04:00
|
|
|
def app() -> Flask:
|
2022-05-17 16:47:55 -04:00
|
|
|
"""App."""
|
2022-05-19 14:38:47 -04:00
|
|
|
os.environ["FLASK_ENV"] = "testing"
|
2022-05-17 16:35:38 -04:00
|
|
|
app = create_app()
|
2022-05-19 16:08:38 -04:00
|
|
|
|
|
|
|
# NOTE: set this here since nox shoves tests and src code to
|
|
|
|
# different places and this allows us to know exactly where we are at the start
|
|
|
|
app.config["BPMN_SPEC_ABSOLUTE_DIR"] = (
|
|
|
|
os.path.join(os.path.dirname(__file__))
|
2022-06-01 11:17:25 -04:00
|
|
|
+ "/tests/spiffworkflow_backend/files/bpmn_specs"
|
2022-05-19 16:08:38 -04:00
|
|
|
)
|
|
|
|
|
2022-05-17 16:35:38 -04:00
|
|
|
return app
|