Skip to content

Commit ca5c4c5

Browse files
committed
Update .flake8 configuration and modify conftest.py for environment variable setup
- Added 'conftest.py' to the exclude list in the .flake8 configuration to prevent linting errors. - Moved environment variable setup for testing into 'conftest.py' to ensure required variables are set before importing the app and settings.
1 parent 89d8aa1 commit ca5c4c5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

commitly-backend/.flake8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[flake8]
22
application-import-names = app
33
max-line-length = 88
4-
exclude = .git,__pycache__,venv,.venv,migrations,alembic
4+
exclude = .git,__pycache__,venv,.venv,migrations,alembic,conftest.py
55

66
# For Black compatibility
77
extend-ignore = E203, W503, I101

commitly-backend/tests/conftest.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
from collections.abc import Generator
22
import os
33

4+
# Ensure required env vars are set before importing the app/settings
5+
os.environ.setdefault("DATABASE_URL", "sqlite:///./test.db")
6+
os.environ.setdefault("SUPABASE_URL", "http://localhost:8000")
7+
os.environ.setdefault("SUPABASE_ANON_KEY", "anon")
8+
49
from fastapi.testclient import TestClient
510
import pytest
611
from sqlalchemy.orm import Session
@@ -9,11 +14,6 @@
914
from app.main import app
1015
from app.models.waitlist import Waitlist
1116

12-
# Ensure required env vars are set before importing the app/settings
13-
os.environ.setdefault("DATABASE_URL", "sqlite:///./test.db")
14-
os.environ.setdefault("SUPABASE_URL", "http://localhost:8000")
15-
os.environ.setdefault("SUPABASE_ANON_KEY", "anon")
16-
1717
# Create tables once for the test database
1818
Base.metadata.create_all(bind=engine)
1919

0 commit comments

Comments
 (0)