8000 [summary] total errors/warnings/duration are printed · postgrespro/testgres@98d032f · GitHub
[go: up one dir, main page]

Skip to content

Commit 98d032f

Browse files
[summary] total errors/warnings/duration are printed
1 parent f56fc94 commit 98d032f

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/conftest.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ class TEST_PROCESS_STATS:
116116
WarningTests = list[str, int]()
117117
AchtungTests = list[str]()
118118

119+
cTotalDuration: datetime.timedelta = datetime.timedelta()
120+
121+
cTotalErrors: int = 0
122+
cTotalWarnings: int = 0
123+
119124
# --------------------------------------------------------------------
120125
def incrementTotalTestCount() -> None:
121126
assert type(__class__.cTotalTests) == int # noqa: E721
@@ -169,6 +174,14 @@ def incrementFailedTestCount(testID: str, errCount: int) -> None:
169174
assert __class__.cFailedTests > 0
170175
assert len(__class__.FailedTests) == __class__.cFailedTests
171176

177+
# --------
178+
assert type(__class__.cTotalErrors) == int # noqa: E721
179+
assert __class__.cTotalErrors >= 0
180+
181+
__class__.cTotalErrors += errCount
182+
183+
assert __class__.cTotalErrors > 0
184+
172185
# --------------------------------------------------------------------
173186
def incrementXFailedTestCount(testID: str, errCount: int) -> None:
174187
assert type(testID) == str # noqa: E721
@@ -225,6 +238,14 @@ def incrementWarningTestCount(testID: str, warningCount: int) -> None:
225238
assert __class__.cWarningTests > 0
226239
assert len(__class__.WarningTests) == __class__.cWarningTests
227240

241+
# --------
242+
assert type(__class__.cTotalWarnings) == int # noqa: E721
243+
assert __class__.cTotalWarnings >= 0
244+
245+
__class__.cTotalWarnings += warningCount
246+
247+
assert __class__.cTotalWarnings > 0
248+
228249
# --------------------------------------------------------------------
229250
def incrementUnexpectedTests() -> None:
230251
assert type(__class__.cUnexpectedTests) == int # noqa: E721
@@ -454,6 +475,7 @@ def helper__makereport__call(
454475
logging.error(call.excinfo.value)
455476
item_error_msg_count += 1
456477

478+
assert item_error_msg_count > 0
457479
TEST_PROCESS_STATS.incrementFailedTestCount(testID, item_error_msg_count)
458480

459481
exitStatus = "FAILED"
@@ -487,6 +509,14 @@ def helper__makereport__call(
487509
if item_warning_msg_count > 0:
488510
TEST_PROCESS_STATS.incrementWarningTestCount(testID, item_warning_msg_count)
489511

512+
# --------
513+
assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721
514+
assert type(testDurration) == datetime.timedelta # noqa: E721
515+
516+
TEST_PROCESS_STATS.cTotalDuration += testDurration
517+
518+
assert testDurration <= TEST_PROCESS_STATS.cTotalDuration
519+
490520
# --------
491521
logging.info("*")
492522
logging.info("* DURATION : {0}".format(timedelta_to_human_text(testDurration)))
@@ -892,6 +922,23 @@ def LOCAL__print_test_list2(
892922
logging.info(" UNEXPECTED : {0}".format(TEST_PROCESS_STATS.cUnexpectedTests))
893923
logging.info("")
894924

925+
assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721
926+
927+
LOCAL__print_line1_with_header("TIME")
928+
logging.info("")
929+
logging.info(
930+
" TOTAL DURATION: {0}".format(
931+
timedelta_to_human_text(TEST_PROCESS_STATS.cTotalDuration)
932+
)
933+
)
934+
logging.info("")
935+
936+
LOCAL__print_line1_with_header("TOTAL INFORMATION")
937+
logging.info("")
938+
logging.info(" TOTAL ERROR COUNT : {0}".format(TEST_PROCESS_STATS.cTotalErrors))
939+
logging.info(" TOTAL WARNING COUNT: {0}".format(TEST_PROCESS_STATS.cTotalWarnings))
940+
logging.info("")
941+
895942

896943
# /////////////////////////////////////////////////////////////////////////////
897944

0 commit comments

Comments
 (0)
0