Improve exception handling in integration test tearDown methods

Address CodeRabbit feedback by replacing bare except clauses with
specific Exception handling:
- test_activity_integration.py: Fix 2 tearDown methods
- test_app_integration.py: Fix 1 tearDown method

Changes:
- Replace bare 'except:' with 'except Exception as e:'
- Add explanatory comments for why exceptions are caught
- Maintain same functionality while improving code quality

Tests still pass: 11/13 integration tests passing (85%)
This commit is contained in:
Claude 2025-11-08 16:08:25 +00:00
parent bdf2863083
commit 9df6a8b8fa
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

View file

@ -83,7 +83,8 @@ class TestActivityIntegration(unittest.TestCase):
self.db.session.remove()
try:
self.db.drop_all()
except:
except Exception as e:
# Drop all may fail if db is already cleaned up
pass
self.app_context.pop()
@ -454,7 +455,8 @@ class TestActivityMetadataOperations(unittest.TestCase):
self.db.session.remove()
try:
self.db.drop_all()
except:
except Exception as e:
# Drop all may fail if db is already cleaned up
pass
self.app_context.pop()
self.app_module.app = self.original_app

View file

@ -65,7 +65,8 @@ class TestDatabaseModelsIntegration(unittest.TestCase):
self.db.session.remove()
try:
self.db.drop_all()
except:
except Exception as e:
# Drop all may fail if db is already cleaned up
pass
self.app_context.pop()