diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 5f8ecd4..722ab9f 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -22,4 +22,6 @@ jobs: - name: setup pytest.ini run: mv .github/pytest.ini pytest.ini - name: Run tests + env: + CI: "true" run: poetry run pytest \ No newline at end of file diff --git a/aim/digifeeds/database/main.py b/aim/digifeeds/database/main.py index 8b2b5db..7d3ab71 100644 --- a/aim/digifeeds/database/main.py +++ b/aim/digifeeds/database/main.py @@ -4,9 +4,10 @@ from aim.digifeeds.database import crud, models, schemas from aim.services import S -engine = create_engine(S.mysql_database) -SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) -models.Base.metadata.create_all(bind=engine) +if S.ci_on == None: + engine = create_engine(S.mysql_database) + SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine) + models.Base.metadata.create_all(bind=engine) app = FastAPI() diff --git a/aim/services.py b/aim/services.py index 7e088b1..1a8e087 100644 --- a/aim/services.py +++ b/aim/services.py @@ -4,4 +4,5 @@ S = SimpleNamespace() S.mysql_database = f'mysql+mysqldb://{os.environ["MARIADB_USER"]}:{os.environ["MARIADB_PASSWORD"]}@{os.environ["DATABASE_HOST"]}/{os.environ["DATABASE_HOST"]}' S.test_database = "sqlite:///:memory:" +S.ci_on = os.getenv("CI")