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

scoringengine / scoringengine / 23385248069

21 Mar 2026 05:50PM UTC coverage: 73.202% (-2.5%) from 75.69%
23385248069

push

github

RustyBower
Fix test to match DB fallback behavior for missing output files

The endpoint now returns check.output from DB (200) instead of 404
when the on-disk file doesn't exist.

3726 of 5090 relevant lines covered (73.2%)

0.73 hits per line

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

21.43
/scoring_engine/db.py
1
from flask_sqlalchemy import SQLAlchemy
1✔
2
from sqlalchemy.exc import OperationalError, ProgrammingError
1✔
3

4
# Initialize Flask-SQLAlchemy
5
# This will be configured by the Flask app
6
db = SQLAlchemy()
1✔
7

8

9
def delete_db():
1✔
10
    """Drop all database tables"""
11
    dialect = db.engine.dialect.name
×
12
    with db.engine.connect() as conn:
×
13
        if dialect == "mysql":
×
14
            conn.execute(db.text("SET FOREIGN_KEY_CHECKS = 0"))
×
15
        elif dialect == "sqlite":
×
16
            conn.execute(db.text("PRAGMA foreign_keys = OFF"))
×
17
        conn.commit()
×
18
    db.drop_all()
×
19
    with db.engine.connect() as conn:
×
20
        if dialect == "mysql":
×
21
            conn.execute(db.text("SET FOREIGN_KEY_CHECKS = 1"))
×
22
        elif dialect == "sqlite":
×
23
            conn.execute(db.text("PRAGMA foreign_keys = ON"))
×
24
        conn.commit()
×
25

26

27
def init_db():
1✔
28
    """Create all database tables"""
29
    db.create_all()
×
30

31

32
def verify_db_ready():
1✔
33
    """Verify the database is ready and accessible"""
34
    ready = True
×
35
    try:
×
36
        from scoring_engine.models.user import User
×
37

38
        db.session.get(User, 1)
×
39
    except (OperationalError, ProgrammingError):
×
40
        ready = False
×
41
    return ready
×
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