mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-05 06:12:34 +00:00
feat(tests): add pytest flag to not generate reports after each test
[no changelog]
This commit is contained in:
parent
20f3658e7e
commit
39b1776801
@ -106,13 +106,17 @@ test_emu_click: ## run click tests
|
|||||||
$(EMU_TEST) $(PYTEST) $(TESTPATH)/click_tests $(TESTOPTS)
|
$(EMU_TEST) $(PYTEST) $(TESTPATH)/click_tests $(TESTOPTS)
|
||||||
|
|
||||||
test_emu_ui: ## run ui integration tests
|
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
|
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
|
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
|
test_emu_ui_record_multicore: ## quickly record all screens
|
||||||
make test_emu_ui_multicore || echo "All errors are recorded in fixtures.json"
|
make test_emu_ui_multicore || echo "All errors are recorded in fixtures.json"
|
||||||
|
@ -351,6 +351,13 @@ def pytest_addoption(parser: "Parser") -> None:
|
|||||||
help="Which emulator to use: 'core' or 'legacy'. "
|
help="Which emulator to use: 'core' or 'legacy'. "
|
||||||
"Only valid in connection with `--control-emulators`",
|
"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:
|
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
|
# Not calling `testreport.generate_reports()` not to generate
|
||||||
# the `all_screens` report, as would take a lot of time.
|
# the `all_screens` report, as would take a lot of time.
|
||||||
# That will be generated in `pytest_sessionfinish`.
|
# 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"):
|
if item.session.config.getoption("ui"):
|
||||||
testreport.index()
|
testreport.index()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user