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

conftest is updated - ExitStatusNames#283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletionstests/conftest.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -437,6 +437,16 @@ def helper__makereport__setup(
return


# ------------------------------------------------------------------------
class ExitStatusNames:
FAILED = "FAILED"
PASSED = "PASSED"
XFAILED = "XFAILED"
NOT_XFAILED = "NOT XFAILED"
SKIPPED = "SKIPPED"
UNEXPECTED = "UNEXPECTED"


# ------------------------------------------------------------------------
def helper__makereport__call(
item: pytest.Function, call: pytest.CallInfo, outcome: T_PLUGGY_RESULT
Expand DownExpand Up@@ -486,28 +496,29 @@ def helper__makereport__call(

# --------
exitStatus = None
exitStatusInfo = None
if rep.outcome == "skipped":
assert call.excinfo is not None # research
assert call.excinfo.value is not None # research

if type(call.excinfo.value) == _pytest.outcomes.Skipped: # noqa: E721
assert not hasattr(rep, "wasxfail")

exitStatus ="SKIPPED"
exitStatus =ExitStatusNames.SKIPPED
reasonText = str(call.excinfo.value)
reasonMsgTempl = "SKIP REASON: {0}"

TEST_PROCESS_STATS.incrementSkippedTestCount()

elif type(call.excinfo.value) == _pytest.outcomes.XFailed: # noqa: E721
exitStatus ="XFAILED"
elif type(call.excinfo.value) == _pytest.outcomes.XFailed: # noqa: E721 E501
exitStatus =ExitStatusNames.XFAILED
reasonText = str(call.excinfo.value)
reasonMsgTempl = "XFAIL REASON: {0}"

TEST_PROCESS_STATS.incrementXFailedTestCount(testID, item_error_msg_count)

else:
exitStatus ="XFAILED"
exitStatus =ExitStatusNames.XFAILED
assert hasattr(rep, "wasxfail")
assert rep.wasxfail is not None
assert type(rep.wasxfail) == str # noqa: E721
Expand DownExpand Up@@ -544,7 +555,7 @@ def helper__makereport__call(
assert item_error_msg_count > 0
TEST_PROCESS_STATS.incrementFailedTestCount(testID, item_error_msg_count)

exitStatus ="FAILED"
exitStatus =ExitStatusNames.FAILED
elif rep.outcome == "passed":
assert call.excinfo is None

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

logging.info(warnMsg)
exitStatus ="NOT XFAILED"
exitStatus =ExitStatusNames.NOT_XFAILED
else:
assert not hasattr(rep, "wasxfail")

TEST_PROCESS_STATS.incrementPassedTestCount()
exitStatus ="PASSED"
exitStatus =ExitStatusNames.PASSED
else:
TEST_PROCESS_STATS.incrementUnexpectedTests()
exitStatus = "UNEXPECTED [{0}]".format(rep.outcome)
exitStatus = ExitStatusNames.UNEXPECTED
exitStatusInfo = rep.outcome
# [2025-03-28] It may create a useless problem in new environment.
# assert False

# --------
if item_warning_msg_count > 0:
TEST_PROCESS_STATS.incrementWarningTestCount(testID, item_warning_msg_count)

# --------
assert exitStatus is not None
assert type(exitStatus) == str # noqa: E721

if exitStatus == ExitStatusNames.FAILED:
assert item_error_msg_count > 0
pass

# --------
assert type(TEST_PROCESS_STATS.cTotalDuration) == datetime.timedelta # noqa: E721
assert type(testDurration) == datetime.timedelta # noqa: E721
Expand All@@ -583,11 +603,17 @@ def helper__makereport__call(

assert testDurration <= TEST_PROCESS_STATS.cTotalDuration

# --------
exitStatusLineData = exitStatus

if exitStatusInfo is not None:
exitStatusLineData += " [{}]".format(exitStatusInfo)

# --------
logging.info("*")
logging.info("* DURATION : {0}".format(timedelta_to_human_text(testDurration)))
logging.info("*")
logging.info("* EXIT STATUS : {0}".format(exitStatus))
logging.info("* EXIT STATUS : {0}".format(exitStatusLineData))
logging.info("* ERROR COUNT : {0}".format(item_error_msg_count))
logging.info("* WARNING COUNT: {0}".format(item_warning_msg_count))
logging.info("*")
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp