Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit79bc692

Browse files
conftest is updated - ExitStatusNames (#283)
It is a synchronization with our internal tests.
1 parent28dac03 commit79bc692

File tree

1 file changed

+35
-9
lines changed

1 file changed

+35
-9
lines changed

‎tests/conftest.py

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,16 @@ def helper__makereport__setup(
437437
return
438438

439439

440+
# ------------------------------------------------------------------------
441+
classExitStatusNames:
442+
FAILED="FAILED"
443+
PASSED="PASSED"
444+
XFAILED="XFAILED"
445+
NOT_XFAILED="NOT XFAILED"
446+
SKIPPED="SKIPPED"
447+
UNEXPECTED="UNEXPECTED"
448+
449+
440450
# ------------------------------------------------------------------------
441451
defhelper__makereport__call(
442452
item:pytest.Function,call:pytest.CallInfo,outcome:T_PLUGGY_RESULT
@@ -486,28 +496,29 @@ def helper__makereport__call(
486496

487497
# --------
488498
exitStatus=None
499+
exitStatusInfo=None
489500
ifrep.outcome=="skipped":
490501
assertcall.excinfoisnotNone# research
491502
assertcall.excinfo.valueisnotNone# research
492503

493504
iftype(call.excinfo.value)==_pytest.outcomes.Skipped:# noqa: E721
494505
assertnothasattr(rep,"wasxfail")
495506

496-
exitStatus="SKIPPED"
507+
exitStatus=ExitStatusNames.SKIPPED
497508
reasonText=str(call.excinfo.value)
498509
reasonMsgTempl="SKIP REASON: {0}"
499510

500511
TEST_PROCESS_STATS.incrementSkippedTestCount()
501512

502-
eliftype(call.excinfo.value)==_pytest.outcomes.XFailed:# noqa: E721
503-
exitStatus="XFAILED"
513+
eliftype(call.excinfo.value)==_pytest.outcomes.XFailed:# noqa: E721 E501
514+
exitStatus=ExitStatusNames.XFAILED
504515
reasonText=str(call.excinfo.value)
505516
reasonMsgTempl="XFAIL REASON: {0}"
506517

507518
TEST_PROCESS_STATS.incrementXFailedTestCount(testID,item_error_msg_count)
508519

509520
else:
510-
exitStatus="XFAILED"
521+
exitStatus=ExitStatusNames.XFAILED
511522
asserthasattr(rep,"wasxfail")
512523
assertrep.wasxfailisnotNone
513524
asserttype(rep.wasxfail)==str# noqa: E721
@@ -544,7 +555,7 @@ def helper__makereport__call(
544555
assertitem_error_msg_count>0
545556
TEST_PROCESS_STATS.incrementFailedTestCount(testID,item_error_msg_count)
546557

547-
exitStatus="FAILED"
558+
exitStatus=ExitStatusNames.FAILED
548559
elifrep.outcome=="passed":
549560
assertcall.excinfoisNone
550561

@@ -559,22 +570,31 @@ def helper__makereport__call(
559570
warnMsg+=" ["+rep.wasxfail+"]"
560571

561572
logging.info(warnMsg)
562-
exitStatus="NOT XFAILED"
573+
exitStatus=ExitStatusNames.NOT_XFAILED
563574
else:
564575
assertnothasattr(rep,"wasxfail")
565576

566577
TEST_PROCESS_STATS.incrementPassedTestCount()
567-
exitStatus="PASSED"
578+
exitStatus=ExitStatusNames.PASSED
568579
else:
569580
TEST_PROCESS_STATS.incrementUnexpectedTests()
570-
exitStatus="UNEXPECTED [{0}]".format(rep.outcome)
581+
exitStatus=ExitStatusNames.UNEXPECTED
582+
exitStatusInfo=rep.outcome
571583
# [2025-03-28] It may create a useless problem in new environment.
572584
# assert False
573585

574586
# --------
575587
ifitem_warning_msg_count>0:
576588
TEST_PROCESS_STATS.incrementWarningTestCount(testID,item_warning_msg_count)
577589

590+
# --------
591+
assertexitStatusisnotNone
592+
asserttype(exitStatus)==str# noqa: E721
593+
594+
ifexitStatus==ExitStatusNames.FAILED:
595+
assertitem_error_msg_count>0
596+
pass
597+
578598
# --------
579599
asserttype(TEST_PROCESS_STATS.cTotalDuration)==datetime.timedelta# noqa: E721
580600
asserttype(testDurration)==datetime.timedelta# noqa: E721
@@ -583,11 +603,17 @@ def helper__makereport__call(
583603

584604
asserttestDurration<=TEST_PROCESS_STATS.cTotalDuration
585605

606+
# --------
607+
exitStatusLineData=exitStatus
608+
609+
ifexitStatusInfoisnotNone:
610+
exitStatusLineData+=" [{}]".format(exitStatusInfo)
611+
586612
# --------
587613
logging.info("*")
588614
logging.info("* DURATION : {0}".format(timedelta_to_human_text(testDurration)))
589615
logging.info("*")
590-
logging.info("* EXIT STATUS : {0}".format(exitStatus))
616+
logging.info("* EXIT STATUS : {0}".format(exitStatusLineData))
591617
logging.info("* ERROR COUNT : {0}".format(item_error_msg_count))
592618
logging.info("* WARNING COUNT: {0}".format(item_warning_msg_count))
593619
logging.info("*")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp