-
Notifications
You must be signed in to change notification settings - Fork 302
Issue - 661 (Database migration runs during doctest execution) : replaced deprecated code #713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Veeresh K <[email protected]>
Signed-off-by: Veeresh K <[email protected]>
This HTML file was accidentally committed. MkDocs automatically generates HTML from the index.md file during the build process. Committed HTML files are not needed and can cause conflicts with the documentation build system.
d8a14e1
to
ecb82e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Review: Issue #661 - Database Migration Runs During Doctest Execution
Issue Summary
Issue #661: Database migration was being triggered during doctest execution, causing test failures due to deprecated datetime.utcnow()
usage.
PR #713 Analysis
Original Changes by nmveeresh
The PR addressed the core issue by replacing deprecated datetime code:
Before (Deprecated):
import datetime
expired_payload = {'sub': 'bob', 'exp': datetime.utcnow() - datetime.timedelta(hours=1)}
After (Fixed):
from datetime import datetime, timezone, timedelta
expired_payload = {'sub': 'bob', 'exp': datetime.now(timezone.utc) - timedelta(hours=1)}
Files Modified
mcpgateway/utils/verify_credentials.py
- Fixed deprecated datetime usagemcpgateway/main.py
- Related updates for datetime handlingdocs/docs/using/plugins/index.html
- Accidentally added file (now removed)
Additional Cleanup Performed
Removed Unnecessary File
- File:
docs/docs/using/plugins/index.html
- Reason: Auto-generated HTML file that shouldn't be committed
- Details:
- MkDocs automatically generates HTML from markdown files during build
- This was likely generated by VSCode's markdown preview
- Including it would conflict with MkDocs build system
- Removed in commit:
ecb82e5
Current Branch Status
- Branch:
issue_661/db-migr-doctest
- Rebased onto latest main (includes recent PRs #710, #711, #712)
- Ready for final review and merge
Test Results
As reported in original PR:
- 394 tests passed
- 8 skipped (by +SKIP option)
Recommendation
The PR correctly fixes the datetime deprecation issue that was causing doctest failures. With the removal of the accidentally committed HTML file and successful rebase to latest main, this PR is ready to merge.
Commits in Branch
4a6ccbe
- replaced deprecated code (original fix)3f449df
- removed whitespaces (cleanup)ecb82e5
- Remove auto-generated index.html file (additional cleanup)
…aced deprecated code (IBM#713) * replaced deprecated code Signed-off-by: Veeresh K <[email protected]> * removed whitespaces Signed-off-by: Veeresh K <[email protected]> * Remove auto-generated index.html file This HTML file was accidentally committed. MkDocs automatically generates HTML from the index.md file during the build process. Committed HTML files are not needed and can cause conflicts with the documentation build system. --------- Signed-off-by: Veeresh K <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
…aced deprecated code (IBM#713) * replaced deprecated code Signed-off-by: Veeresh K <[email protected]> * removed whitespaces Signed-off-by: Veeresh K <[email protected]> * Remove auto-generated index.html file This HTML file was accidentally committed. MkDocs automatically generates HTML from the index.md file during the build process. Committed HTML files are not needed and can cause conflicts with the documentation build system. --------- Signed-off-by: Veeresh K <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
…aced deprecated code (IBM#713) * replaced deprecated code Signed-off-by: Veeresh K <[email protected]> * removed whitespaces Signed-off-by: Veeresh K <[email protected]> * Remove auto-generated index.html file This HTML file was accidentally committed. MkDocs automatically generates HTML from the index.md file during the build process. Committed HTML files are not needed and can cause conflicts with the documentation build system. --------- Signed-off-by: Veeresh K <[email protected]> Co-authored-by: Mihai Criveti <[email protected]>
Fixes issue #661.
The verify_credentials.py file was using datetime.utcnow(), which caused doctest failures due to it returning a naive datetime object.
This has been replaced with timezone-aware code using datetime.now(timezone.utc) and timedelta to ensure correct datetime handling.
Key changes:
Deprecated:
Fix:
Test Results:
SKIPPED [8] ../../.venv/mcpgateway/lib/python3.12/site-packages/_pytest/doctest.py:458: all tests skipped by +SKIP option
394 passed, 8 skipped in 11.65s
Closes #661