Skip to content

Commit

Permalink
Don't run scheduler when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
major committed Jun 12, 2024
1 parent a146d52 commit 3873128
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cid/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from sqlalchemy.orm import Session

from cid import crud
from cid.config import ENVIRONMENT
from cid.database import SessionLocal
from cid.utils import wait_for_database

Expand Down Expand Up @@ -67,5 +68,7 @@ def run_schedule() -> None:


# Run the schedule in a separate thread
schedule_thread = threading.Thread(target=run_schedule)
schedule_thread.start()
# NOTE(major): Pytest runs this code for some reason. This is a workaround.
if ENVIRONMENT != "testing":
schedule_thread = threading.Thread(target=run_schedule)
schedule_thread.start()

0 comments on commit 3873128

Please sign in to comment.