mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
ci: reduce pytest job stdout log
This commit is contained in:
parent
859d9a89e1
commit
b887f476da
38
conftest.py
38
conftest.py
@ -448,3 +448,41 @@ def pytest_unconfigure(config: Config) -> None:
|
||||
if _pytest_embedded:
|
||||
del config.stash[IDF_PYTEST_EMBEDDED_KEY]
|
||||
config.pluginmanager.unregister(_pytest_embedded)
|
||||
|
||||
|
||||
dut_artifacts_url = []
|
||||
|
||||
|
||||
@pytest.hookimpl(hookwrapper=True)
|
||||
def pytest_runtest_makereport(item, call): # type: ignore
|
||||
outcome = yield
|
||||
report = outcome.get_result()
|
||||
report.sections = []
|
||||
if report.failed:
|
||||
_dut = item.funcargs.get('dut')
|
||||
if not _dut:
|
||||
return
|
||||
|
||||
job_id = os.getenv('CI_JOB_ID', 0)
|
||||
url = os.getenv('CI_PAGES_URL', '').replace('esp-idf', '-/esp-idf')
|
||||
template = f'{url}/-/jobs/{job_id}/artifacts/pytest_embedded_log/{{}}'
|
||||
logs_files = []
|
||||
|
||||
def get_path(x: str) -> str:
|
||||
return x.split('pytest_embedded_log/', 1)[1]
|
||||
if isinstance(_dut, list):
|
||||
logs_files.extend([template.format(get_path(d.logfile)) for d in _dut])
|
||||
dut_artifacts_url.append('{}:'.format(_dut[0].test_case_name))
|
||||
else:
|
||||
logs_files.append(template.format(get_path(_dut.logfile)))
|
||||
dut_artifacts_url.append('{}:'.format(_dut.test_case_name))
|
||||
|
||||
for file in logs_files:
|
||||
dut_artifacts_url.append(' - {}'.format(file))
|
||||
|
||||
|
||||
def pytest_terminal_summary(terminalreporter, exitstatus, config): # type: ignore
|
||||
if dut_artifacts_url:
|
||||
terminalreporter.ensure_newline()
|
||||
terminalreporter.section('Failed Test Artifacts URL', sep='-', red=True, bold=True)
|
||||
terminalreporter.line('\n'.join(dut_artifacts_url))
|
||||
|
@ -5,7 +5,6 @@ python_files = pytest_*.py
|
||||
# ignore PytestExperimentalApiWarning for record_xml_attribute
|
||||
# set traceback to "short" to prevent the overwhelming tracebacks
|
||||
addopts =
|
||||
-s -vv
|
||||
--embedded-services esp,idf
|
||||
--tb short
|
||||
--strict-markers
|
||||
@ -23,7 +22,7 @@ filterwarnings =
|
||||
|
||||
# log related
|
||||
log_cli = True
|
||||
log_cli_level = INFO
|
||||
log_cli_level = WARNING
|
||||
log_cli_format = %(asctime)s %(levelname)s %(message)s
|
||||
log_cli_date_format = %Y-%m-%d %H:%M:%S
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user