Fix: Make Flask app test-safe and run full pytest suite in CI#143
Merged
Vishnu2707 merged 2 commits intoJun 21, 2026
Conversation
TFT444
approved these changes
Jun 15, 2026
TFT444
left a comment
Collaborator
There was a problem hiding this comment.
Hey @emon22-ts ,
I reviewed this. The api/app.py fix is the right approach, wrapping migrations in the DATABASE_URL check makes the app itself safe to import without a database which is the correct root cause fix. CI is green and the full pytest step in CI is a solid addition on top of the existing rule regression tests.
Two small things to note: the pytest command has both -v and -q flags which are contradictory, pick one or You can leave as it is.
Also the PR description still says Closes #[ISSUE NUMBER], looks like the actual issue number was not filled in just put the pr number at the end, please.
Approving this, good work.
ritiksah141
approved these changes
Jun 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Makes the Flask app safe to import without a live DATABASE_URL, then adds the full Python test suite to CI.
Type of change
Problem
Importing api.app triggered create_app() which immediately called DatabaseManager() and db.run_migrations(). DatabaseManager.init reads os.environ["DATABASE_URL"] and raises KeyError when it is not set. This caused the full test suite to fail at collection time with no DATABASE_URL available in CI.
Fix
api/app.py
Wrapped the migration block in a DATABASE_URL check:
.github/workflows/ci.yml
Added CHECK 8 — runs the full pytest suite excluding smoke_test.py with OPENSHIELD_ENV=development so JWT secret validation stays permissive during tests.
Acceptance criteria
Testing
Related issue
Closes #[ISSUE NUMBER]