1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-05 12:21:16 +00:00

tests: rename report_test to testreport so that pytest doesn't think it is a testcase

This commit is contained in:
matejcik 2020-05-11 16:23:12 +02:00 committed by matejcik
parent aeaa402b75
commit 17c4d75b40
3 changed files with 7 additions and 7 deletions

View File

@ -25,7 +25,7 @@ from trezorlib.transport import enumerate_devices, get_transport
from . import ui_tests from . import ui_tests
from .device_handler import BackgroundDeviceHandler from .device_handler import BackgroundDeviceHandler
from .ui_tests.reporting import report_test from .ui_tests.reporting import testreport
def get_device(): def get_device():
@ -149,7 +149,7 @@ def client(request):
def pytest_sessionstart(session): def pytest_sessionstart(session):
ui_tests.read_fixtures() ui_tests.read_fixtures()
if session.config.getoption("ui") == "test": if session.config.getoption("ui") == "test":
report_test.clear_dir() testreport.clear_dir()
def _should_write_ui_report(exitstatus): def _should_write_ui_report(exitstatus):
@ -166,7 +166,7 @@ def pytest_sessionfinish(session, exitstatus):
if session.config.getoption("ui") == "test": if session.config.getoption("ui") == "test":
if session.config.getoption("ui_check_missing") and ui_tests.list_missing(): if session.config.getoption("ui_check_missing") and ui_tests.list_missing():
session.exitstatus = pytest.ExitCode.TESTS_FAILED session.exitstatus = pytest.ExitCode.TESTS_FAILED
report_test.index() testreport.index()
if session.config.getoption("ui") == "record": if session.config.getoption("ui") == "record":
ui_tests.write_fixtures(session.config.getoption("ui_check_missing")) ui_tests.write_fixtures(session.config.getoption("ui_check_missing"))
@ -191,7 +191,7 @@ def pytest_terminal_summary(terminalreporter, exitstatus, config):
println() println()
if _should_write_ui_report(exitstatus): if _should_write_ui_report(exitstatus):
println(f"UI tests summary: {report_test.REPORTS_PATH / 'index.html'}") println(f"UI tests summary: {testreport.REPORTS_PATH / 'index.html'}")
def pytest_addoption(parser): def pytest_addoption(parser):

View File

@ -7,7 +7,7 @@ from pathlib import Path
import pytest import pytest
from .reporting import report_test from .reporting import testreport
UI_TESTS_DIR = Path(__file__).parent.resolve() UI_TESTS_DIR = Path(__file__).parent.resolve()
HASH_FILE = UI_TESTS_DIR / "fixtures.json" HASH_FILE = UI_TESTS_DIR / "fixtures.json"
@ -61,7 +61,7 @@ def _process_tested(fixture_test_path, test_name):
_rename_records(actual_path) _rename_records(actual_path)
if actual_hash != expected_hash: if actual_hash != expected_hash:
file_path = report_test.failed( file_path = testreport.failed(
fixture_test_path, test_name, actual_hash, expected_hash fixture_test_path, test_name, actual_hash, expected_hash
) )
@ -71,7 +71,7 @@ def _process_tested(fixture_test_path, test_name):
) )
) )
else: else:
report_test.passed(fixture_test_path, test_name, actual_hash) testreport.passed(fixture_test_path, test_name, actual_hash)
@contextmanager @contextmanager