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:
parent
bdf2863083
commit
9df6a8b8fa
2 changed files with 6 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue