• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

crane-cloud / database-api / #8

20 Mar 2024 09:55PM UTC coverage: 17.99%. First build
#8

Pull #16

coveralls-python

rhodinemma
chore: setup test environment and add initial test
Pull Request #16: chore: setup testing environment and add initial test

3 of 4 new or added lines in 1 file covered. (75.0%)

222 of 1234 relevant lines covered (17.99%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/app/database.py
1
import os
1✔
2
from sqlalchemy import create_engine
1✔
3
from sqlalchemy.orm import sessionmaker
1✔
4
from sqlalchemy_utils import create_database, database_exists
1✔
5
from config import settings
1✔
6
from sqlalchemy.ext.declarative import declarative_base
1✔
7

8
if os.environ.get("FASTAPI_ENV") == "testing":
1✔
9
    DATABASE_URI = "postgresql://postgres:postgres@localhost:4200/cranecloud_test"
1✔
10
else:
NEW
11
    DATABASE_URI = settings.DATABASE_URI
×
12

13
if not database_exists(DATABASE_URI):
1✔
14
    create_database(DATABASE_URI)
×
15

16

17
engine = create_engine(DATABASE_URI, pool_pre_ping=True)
1✔
18

19
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
1✔
20

21
Base = declarative_base()
1✔
22

23
# Base.metadata.create_all(bind=engine)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc