From 908b2e1038e83f3241440462e83bdd56c1b24104 Mon Sep 17 00:00:00 2001 From: Bartlomiej Hirsz Date: Sun, 5 Nov 2023 17:11:22 +0100 Subject: [PATCH] Fix missing alias logs --- src/DatabaseLibrary/assertion.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/DatabaseLibrary/assertion.py b/src/DatabaseLibrary/assertion.py index 5831492..d55c3fb 100644 --- a/src/DatabaseLibrary/assertion.py +++ b/src/DatabaseLibrary/assertion.py @@ -110,7 +110,7 @@ def row_count_is_0(self, selectStatement, sansTran=False, msg=None, alias=None): Using optional `msg` to override the default error message: | Row Count is 0 | SELECT id FROM person WHERE first_name = 'Franz Allan' | msg=my error message | """ - logger.info(f"Executing : Row Count Is 0 | selectStatement") + logger.info(f"Executing : Row Count Is 0 [{alias}] | selectStatement") num_rows = self.row_count(selectStatement, sansTran, alias=alias) if num_rows > 0: raise AssertionError(msg or f"Expected 0 rows, but {num_rows} were returned from: '{selectStatement}'") @@ -141,7 +141,7 @@ def row_count_is_equal_to_x(self, selectStatement, numRows, sansTran=False, msg= Using optional `msg` to override the default error message: | Row Count Is Equal To X | SELECT id FROM person | 1 | msg=my error message | """ - logger.info(f"Executing : Row Count Is Equal To X | {selectStatement} | {numRows}") + logger.info(f"Executing : Row Count Is Equal To X [{alias}] | {selectStatement} | {numRows}") num_rows = self.row_count(selectStatement, sansTran, alias=alias) if num_rows != int(numRows.encode("ascii")): raise AssertionError( @@ -174,7 +174,7 @@ def row_count_is_greater_than_x(self, selectStatement, numRows, sansTran=False, Using optional `msg` to override the default error message: | Row Count Is Greater Than X | SELECT id FROM person WHERE first_name = 'John' | 0 | msg=my error message | """ - logger.info(f"Executing : Row Count Is Greater Than X | {selectStatement} | {numRows}") + logger.info(f"Executing : Row Count Is Greater Than X [{alias}] | {selectStatement} | {numRows}") num_rows = self.row_count(selectStatement, sansTran, alias=alias) if num_rows <= int(numRows.encode("ascii")): raise AssertionError( @@ -207,7 +207,7 @@ def row_count_is_less_than_x(self, selectStatement, numRows, sansTran=False, msg Using optional `msg` to override the default error message: | Row Count Is Less Than X | SELECT id FROM person WHERE first_name = 'John' | 1 | msg=my error message | """ - logger.info(f"Executing : Row Count Is Less Than X | {selectStatement} | {numRows}") + logger.info(f"Executing : Row Count Is Less Than X [{alias}] | {selectStatement} | {numRows}") num_rows = self.row_count(selectStatement, sansTran, alias=alias) if num_rows >= int(numRows.encode("ascii")): raise AssertionError( @@ -235,7 +235,7 @@ def table_must_exist(self, tableName, sansTran=False, msg=None, alias=None): Using optional `msg` to override the default error message: | Table Must Exist | first_name | msg=my error message | """ - logger.info("Executing : Table Must Exist | %s " % tableName) + logger.info(f"Executing : Table Must Exist [{alias}] | {tableName}") _, db_api_module_name = self._cache.switch(alias) if db_api_module_name in ["cx_Oracle", "oracledb"]: selectStatement = (