@@ -1,2 +1,3 @@ | |||||
pytest==5.3.0 | pytest==5.3.0 | ||||
pytest-sphinx==0.2.2 | |||||
pytest-sphinx>=0.2.2 | |||||
pytest-json-report>=1.2.1 |
@@ -76,7 +76,7 @@ setup_kwargs = dict( | |||||
ext_modules=[PrecompiledExtesion('megengine._internal._mgb')], | ext_modules=[PrecompiledExtesion('megengine._internal._mgb')], | ||||
install_requires=requires, | install_requires=requires, | ||||
extras_require={ | extras_require={ | ||||
'dev': [*requires_style, *requires_test], | |||||
'dev': requires_style + requires_test, | |||||
'ci': requires_test, | 'ci': requires_test, | ||||
}, | }, | ||||
cmdclass={'build_ext': build_ext}, | cmdclass={'build_ext': build_ext}, | ||||
@@ -1,4 +1,3 @@ | |||||
# -*- coding: utf-8 -*- | |||||
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") | # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") | ||||
# | # | ||||
# Copyright (c) 2014-2020 Megvii Inc. All rights reserved. | # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. | ||||
@@ -10,3 +9,26 @@ import os | |||||
import sys | import sys | ||||
sys.path.append(os.path.join(os.path.dirname(__file__))) | sys.path.append(os.path.join(os.path.dirname(__file__))) | ||||
def pytest_json_modifyreport(json_report): | |||||
events = [] | |||||
timestamp = 0 | |||||
for item in json_report["tests"]: | |||||
for stage in ["setup", "call", "teardown"]: | |||||
if stage in item: | |||||
events.append( | |||||
{ | |||||
"name": item["nodeid"], | |||||
"ph": "X", | |||||
"ts": timestamp, | |||||
"dur": item[stage]["duration"] * 1e6, | |||||
"cat": stage, | |||||
"pid": stage, | |||||
"tid": item["nodeid"], | |||||
} | |||||
) | |||||
timestamp += events[-1]["dur"] | |||||
json_report["traceEvents"] = events | |||||
del json_report["collectors"] | |||||
del json_report["tests"] |
@@ -2,6 +2,7 @@ | |||||
pushd $(dirname "${BASH_SOURCE[0]}")/.. >/dev/null | pushd $(dirname "${BASH_SOURCE[0]}")/.. >/dev/null | ||||
pytest -xv -m 'not internet' \ | pytest -xv -m 'not internet' \ | ||||
--json-report --json-report-file=time_python_test.json \ | |||||
--ignore test/unit/module/test_pytorch.py \ | --ignore test/unit/module/test_pytorch.py \ | ||||
--ignore test/pytorch_comparison \ | --ignore test/pytorch_comparison \ | ||||
--ignore test/unit/hub/test_hub.py \ | --ignore test/unit/hub/test_hub.py \ | ||||