Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit c0fe230

Browse files
committed
updated test_perf_utils.py, added dump to html
* update TestResults class's dump method by adding ability to save performance testing results into html files
1 parent 64c577d commit c0fe230

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

sdc/tests/tests_perf/test_perf_utils.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ def get_times(f, *args, iter_number=5):
197197

198198
class TestResults:
199199
perf_results_xlsx = 'perf_results.xlsx'
200+
perf_results_html = 'perf_results.html'
200201
raw_perf_results_xlsx = 'raw_perf_results.xlsx'
202+
raw_perf_results_html = 'raw_perf_results.html'
201203
index = ['name', 'N', 'type', 'size']
202204
test_results_data = pandas.DataFrame(index=index)
203205
logger = setup_logging()
@@ -270,7 +272,7 @@ def print(self):
270272

271273
def dump(self):
272274
"""
273-
Dump performance testing results from global data storage to excel
275+
Dump performance testing results from global data storage to excel and html
274276
"""
275277
# openpyxl need to be installed
276278

@@ -281,13 +283,28 @@ def dump(self):
281283
msg = 'Could not dump the results to "%s": %s'
282284
self.logger.warning(msg, self.perf_results_xlsx, e)
283285

286+
try:
287+
with open(self.perf_results_html, 'w') as the_file:
288+
the_file.write(self.grouped_data.to_html())
289+
except IOError as e:
290+
msg = 'Could not dump raw results to "%s": %s'
291+
self.logger.warning(msg, self.perf_results_html, e)
292+
284293
try:
285294
with pandas.ExcelWriter(self.raw_perf_results_xlsx) as writer:
286295
self.test_results_data.to_excel(writer, index=False)
287296
except ModuleNotFoundError as e:
288297
msg = 'Could not dump raw results to "%s": %s'
289298
self.logger.warning(msg, self.raw_perf_results_xlsx, e)
290299

300+
try:
301+
with open(self.raw_perf_results_html, 'w') as the_file:
302+
the_file.write(self.test_results_data.to_html())
303+
except IOError as e:
304+
msg = 'Could not dump raw results to "%s": %s'
305+
self.logger.warning(msg, self.raw_perf_results_html, e)
306+
307+
291308
def load(self):
292309
"""
293310
Load existing performance testing results from excel to global data storage

0 commit comments

Comments
 (0)