mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 05:28:40 +00:00
feat(tests): generate index on demand when looking at results through show_results.py
This commit is contained in:
parent
4b2b0e457b
commit
6af42b523d
@ -5,6 +5,7 @@ import json
|
||||
import multiprocessing
|
||||
import os
|
||||
import posixpath
|
||||
import sys
|
||||
import time
|
||||
import webbrowser
|
||||
from pathlib import Path
|
||||
@ -13,9 +14,13 @@ from urllib.parse import unquote
|
||||
import click
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
TEST_RESULT_PATH = ROOT / "tests" / "ui_tests" / "reporting" / "reports" / "test"
|
||||
UI_TESTS_PATH = ROOT / "tests" / "ui_tests"
|
||||
TEST_RESULT_PATH = UI_TESTS_PATH / "reporting" / "reports" / "test"
|
||||
FIXTURES_PATH = ROOT / "tests" / "ui_tests" / "fixtures.json"
|
||||
|
||||
sys.path.append(str(UI_TESTS_PATH))
|
||||
from reporting import testreport # noqa: E402
|
||||
|
||||
|
||||
class NoCacheRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
def end_headers(self) -> None:
|
||||
@ -54,6 +59,12 @@ class NoCacheRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||
path += "/"
|
||||
return path
|
||||
|
||||
def do_GET(self) -> None:
|
||||
if self.path in ("/", "/index.html"):
|
||||
testreport.index()
|
||||
|
||||
return super().do_GET()
|
||||
|
||||
def do_POST(self) -> None:
|
||||
if self.path == "/fixtures.json" and FIXTURES_PATH.exists():
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user