1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-11 16:00:57 +00:00

feat(tests): add pytest flag to not generate reports after each test

[no changelog]
This commit is contained in:
grdddj 2023-01-03 15:08:53 +01:00 committed by Jiří Musil
parent 20f3658e7e
commit 39b1776801
2 changed files with 19 additions and 5 deletions

View File

@ -106,13 +106,17 @@ test_emu_click: ## run click tests
$(EMU_TEST) $(PYTEST) $(TESTPATH)/click_tests $(TESTOPTS)
test_emu_ui: ## run ui integration tests
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests --ui=test --ui-check-missing $(TESTOPTS)
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests $(TESTOPTS) \
--ui=test --ui-check-missing --not-generate-report-after-each-test
test_emu_ui_multicore: ## run ui integration tests using multiple cores
$(PYTEST) -n auto $(TESTPATH)/device_tests $(TESTOPTS) --ui=test --ui-check-missing --control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
$(PYTEST) -n auto $(TESTPATH)/device_tests $(TESTOPTS) \
--ui=test --ui-check-missing --not-generate-report-after-each-test \
--control-emulators --model=core --random-order-seed=$(shell echo $$RANDOM)
test_emu_ui_record: ## record and hash screens for ui integration tests
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests --ui=record --ui-check-missing $(TESTOPTS)
$(EMU_TEST) $(PYTEST) $(TESTPATH)/device_tests $(TESTOPTS) \
--ui=record --ui-check-missing --not-generate-report-after-each-test
test_emu_ui_record_multicore: ## quickly record all screens
make test_emu_ui_multicore || echo "All errors are recorded in fixtures.json"

View File

@ -351,6 +351,13 @@ def pytest_addoption(parser: "Parser") -> None:
help="Which emulator to use: 'core' or 'legacy'. "
"Only valid in connection with `--control-emulators`",
)
parser.addoption(
"--not-generate-report-after-each-test",
action="store_true",
default=False,
help="Not generating HTML reports after each test case. "
"Useful for CI tests to speed them up.",
)
def pytest_configure(config: "Config") -> None:
@ -399,6 +406,9 @@ def pytest_runtest_teardown(item: pytest.Item) -> None:
# Not calling `testreport.generate_reports()` not to generate
# the `all_screens` report, as would take a lot of time.
# That will be generated in `pytest_sessionfinish`.
# Optionally generating `index.html` report unless turned off by `pytest` flag
if not item.session.config.getoption("not_generate_report_after_each_test"):
if item.session.config.getoption("ui"):
testreport.index()