Skip to content

Commit

Permalink
add CI env var so gha doesn't try to load mysql
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Sep 19, 2024
1 parent 3eba30a commit f030185
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 4 additions & 3 deletions aim/digifeeds/database/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: # pragma: no cover
engine = create_engine(S.mysql_database)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
models.Base.metadata.create_all(bind=engine)

app = FastAPI()

Expand Down
1 change: 1 addition & 0 deletions aim/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

0 comments on commit f030185

Please sign in to comment.