def load_env(self, *args): if not self.option("no_envs", False): for key in args: load_env(key) return True return False
# http://alexmic.net/flask-sqlalchemy-pytest/ from os import unlink import pytest from os.path import join, exists from sqlalchemy.orm import scoped_session from bountydns.core import load_env from bountydns.core.utils import db_dir, project_dir, storage_dir load_env("api.test") from bountydns.api.api import api from bountydns.db.session import session as _api_session from bountydns.db.session import _session # sessionmaker from bountydns.db import metadata as _metadata from bountydns.db import engine as _engine from bountydns.db.utils import get_resolved_db_path from starlette.testclient import TestClient from bountydns.db.migrate.upgrade import upgrade import logging @pytest.fixture def setlog(caplog): caplog.set_level(logging.INFO) @pytest.fixture(scope="session")