SIENTIAPDE-994
Refactor tests for Postgres activities and improve error handling - Updated test_postgres.py to enhance the testing of load_custom_query method, including cases for None data and date conversion. - Refactored repeat_last_prediction tests to use mocks for SQLAlchemy session execution. - Added tests for export_data_to_postgres method, covering both success and error scenarios. - Improved the initialization tests for Activities class to ensure proper instantiation of dependencies. - Enhanced test coverage for OPC repository connection validation. - Updated tests for prediction workflows to streamline input handling and improve clarity. - Introduced tests for connectors configuration to validate environment variable handling for MLFlow, OPC, and Postgres. - Added tests for logger utility to ensure default settings are correctly applied.
This commit is contained in:
@@ -122,12 +122,17 @@ class OpcRepository():
|
||||
return False
|
||||
|
||||
def disconnect(self):
|
||||
if self.client is None:
|
||||
return
|
||||
self.client.disconnect()
|
||||
self.client = None
|
||||
self.logger.info('Disconnected from OPC server')
|
||||
|
||||
def __del__(self):
|
||||
self.disconnect()
|
||||
try:
|
||||
self.disconnect()
|
||||
except Exception as e:
|
||||
self.logger.error(f"Error in destructor: {e}")
|
||||
|
||||
def validate_connection(self):
|
||||
if self.client is None:
|
||||
|
||||
Reference in New Issue
Block a user