Skip to content

Commit 7137327

Browse files
Danqi Huangfacebook-github-bot
Danqi Huang
authored andcommittedAug 31, 2020
log message at per-test level forperfpipe_pytorch_test_times (pytorch#43752)
Summary: Pull Request resolved: pytorch#43752 Test Plan: {F315930458} {F315930459} Reviewed By: walterddr, malfet Differential Revision: D23387998 Pulled By: dhuang29 fbshipit-source-id: 2da8b607c049a6f8f21d98dbb25e664ea6229f27
1 parent 4c19a1e commit 7137327

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed
 

‎test/print_test_stats.py

+10-8
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,23 @@ def parse_reports(folder):
7777
tests_by_class[class_name].append(test_case)
7878
return tests_by_class
7979

80-
def build_message(test_suite):
80+
def build_message(test_case):
8181
return {
8282
"normal": {
8383
"build_pr": os.environ.get("CIRCLE_PR_NUMBER"),
8484
"build_tag": os.environ.get("CIRCLE_TAG"),
8585
"build_sha1": os.environ.get("CIRCLE_SHA1"),
8686
"build_branch": os.environ.get("CIRCLE_BRANCH"),
87-
"test_name": test_suite.name,
87+
"test_suite_name": test_case.class_name,
88+
"test_case_name": test_case.name,
8889
},
8990
"int": {
9091
"time": int(time.time()),
91-
"test_total_count": len(test_suite.test_cases),
92-
"test_total_time": int(test_suite.total_time * 1000),
93-
"test_failed_count": test_suite.failed_count,
94-
"test_skipped_count": test_suite.skipped_count,
95-
"test_errored_count": test_suite.errored_count,
92+
"test_total_count": 1,
93+
"test_total_time": int(test_case.time * 1000),
94+
"test_failed_count": 1 if test_case.failed > 0 else 0,
95+
"test_skipped_count": 1 if test_case.skipped > 0 else 0,
96+
"test_errored_count": 1 if test_case.errored > 0 else 0,
9697
},
9798
}
9899

@@ -112,10 +113,11 @@ def send_report(reports):
112113
[
113114
{
114115
"category": "perfpipe_pytorch_test_times",
115-
"message": json.dumps(build_message(reports[name])),
116+
"message": json.dumps(build_message(test_case)),
116117
"line_escape": False,
117118
}
118119
for name in sorted(reports.keys())
120+
for test_case in reports[name].test_cases
119121
]
120122
),
121123
},

0 commit comments

Comments
 (0)
Please sign in to comment.