Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 661c519

Browse files
conftest.py is updated. list of "achtung" tests is printed.
For me - it is a right and awesome thing.
1 parent 219764f commit 661c519

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/conftest.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,12 @@ class TEST_PROCESS_STATS:
106106
cSkippedTests: int = 0
107107
cNotXFailedTests: int = 0
108108
cUnexpectedTests: int = 0
109+
cAchtungTests: int = 0
109110

110111
FailedTests = list[str]()
111112
XFailedTests = list[str]()
112113
NotXFailedTests = list[str]()
114+
AchtungTests = list[str]()
113115

114116
# --------------------------------------------------------------------
115117
def incrementTotalTestCount() -> None:
@@ -160,6 +162,13 @@ def incrementNotXFailedTests(testID: str) -> None:
160162
def incrementUnexpectedTests() -> None:
161163
__class__.cUnexpectedTests += 1
162164

165+
# --------------------------------------------------------------------
166+
def incrementAchtungTestCount(testID: str) -> None:
167+
assert type(testID) == str # noqa: E721
168+
assert type(__class__.AchtungTests) == list # noqa: E721
169+
170+
__class__.AchtungTests.append(testID) # raise?
171+
__class__.cAchtungTests += 1
163172

164173
# /////////////////////////////////////////////////////////////////////////////
165174

@@ -234,10 +243,20 @@ def helper__makereport__setup(
234243

235244
assert rep.outcome != "passed"
236245

246+
TEST_PROCESS_STATS.incrementAchtungTestCount(testID)
247+
237248
logging.info(C_LINE1)
238249
logging.info("* ACHTUNG TEST {0}".format(testID))
239250
logging.info("*")
251+
logging.info("* Path : {0}".format(item.path))
240252
logging.info("* Outcome is [{0}]".format(rep.outcome))
253+
254+
if rep.outcome == "failed":
255+
assert call.excinfo is not None
256+
assert call.excinfo.value is not None
257+
logging.info("*")
258+
logging.error(call.excinfo.value)
259+
241260
logging.info("*")
242261
return
243262

@@ -443,6 +462,15 @@ def run_after_tests(request: pytest.FixtureRequest):
443462

444463
yield
445464

465+
logging.info("--------------------------- [ACHTUNG TESTS]")
466+
logging.info("")
467+
468+
assert len(TEST_PROCESS_STATS.AchtungTests) == TEST_PROCESS_STATS.cAchtungTests
469+
470+
if len(TEST_PROCESS_STATS.AchtungTests) > 0:
471+
helper__print_test_list(TEST_PROCESS_STATS.AchtungTests)
472+
logging.info("")
473+
446474
logging.info("--------------------------- [FAILED TESTS]")
447475
logging.info("")
448476

0 commit comments

Comments
 (0)