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 multiprocessing
|
||||||
import os
|
import os
|
||||||
import posixpath
|
import posixpath
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -13,9 +14,13 @@ from urllib.parse import unquote
|
|||||||
import click
|
import click
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
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"
|
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):
|
class NoCacheRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
def end_headers(self) -> None:
|
def end_headers(self) -> None:
|
||||||
@ -54,6 +59,12 @@ class NoCacheRequestHandler(http.server.SimpleHTTPRequestHandler):
|
|||||||
path += "/"
|
path += "/"
|
||||||
return 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:
|
def do_POST(self) -> None:
|
||||||
if self.path == "/fixtures.json" and FIXTURES_PATH.exists():
|
if self.path == "/fixtures.json" and FIXTURES_PATH.exists():
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user