mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-12 00:10:58 +00:00
chore(common): always use resolve() when accessing parent of the Path
[no changelog]
This commit is contained in:
parent
a3c79bf4f7
commit
5d76144ef5
@ -2,7 +2,7 @@ import shutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).parent / ".."
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
sys.path.insert(0, str(ROOT))
|
||||
# Needed for setup purposes, filling the FILE_HASHES dict
|
||||
from tests.ui_tests import read_fixtures # isort:skip
|
||||
@ -16,4 +16,6 @@ for test_case in FILE_HASHES.keys():
|
||||
expected_hash = FILE_HASHES[test_case]
|
||||
actual_hash = _hash_files(recorded_dir)
|
||||
assert expected_hash == actual_hash
|
||||
shutil.make_archive(ROOT / "ci/ui_test_records" / actual_hash, "zip", recorded_dir)
|
||||
shutil.make_archive(
|
||||
str(ROOT / "ci/ui_test_records" / actual_hash), "zip", recorded_dir
|
||||
)
|
||||
|
@ -13,7 +13,7 @@ except ImportError:
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
ROOT = (Path(__file__).parent / "..").resolve()
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
|
||||
if os.environ.get("DEFS_DIR"):
|
||||
DEFS_DIR = Path(os.environ.get("DEFS_DIR")).resolve()
|
||||
|
@ -21,7 +21,7 @@ except Exception:
|
||||
inotify = None
|
||||
|
||||
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
HERE = Path(__file__).resolve().parent
|
||||
MICROPYTHON = HERE / "build" / "unix" / "trezor-emu-core"
|
||||
SRC_DIR = HERE / "src"
|
||||
|
||||
|
@ -4,7 +4,7 @@ from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
import click
|
||||
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
HERE = Path(__file__).resolve().parent
|
||||
|
||||
|
||||
def parse_alloc_data(alloc_data):
|
||||
|
@ -8,7 +8,7 @@ from PIL import Image
|
||||
|
||||
from trezorlib import toif
|
||||
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
HERE = Path(__file__).resolve().parent
|
||||
ROOT = HERE.parent.parent
|
||||
|
||||
ICON_SIZE = (64, 64)
|
||||
|
@ -1,14 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
CORE_DIR = Path(__file__).parent.parent.resolve()
|
||||
CORE_DIR = Path(__file__).resolve().parent.parent
|
||||
EXTMOD_PATH = CORE_DIR / "embed" / "extmod"
|
||||
MOCKS_PATH = CORE_DIR / "mocks" / "generated"
|
||||
|
||||
@ -133,6 +131,7 @@ def do_generate():
|
||||
shutil.rmtree(MOCKS_PATH)
|
||||
build_directory(MOCKS_PATH)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--check":
|
||||
do_check()
|
||||
|
@ -52,7 +52,7 @@ EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
|
||||
|
||||
TEST_ADDRESS_N = tools.parse_path("m/44h/1h/0h/0/0")
|
||||
COMMON_FIXTURES_DIR = (
|
||||
Path(__file__).parent.resolve().parent / "common" / "tests" / "fixtures"
|
||||
Path(__file__).resolve().parent.parent / "common" / "tests" / "fixtures"
|
||||
)
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ from pathlib import Path
|
||||
|
||||
from trezorlib._internal.emulator import CoreEmulator, LegacyEmulator
|
||||
|
||||
ROOT = Path(__file__).parent.parent.resolve()
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
BINDIR = ROOT / "tests" / "emulators"
|
||||
|
||||
LOCAL_BUILD_PATHS = {
|
||||
|
@ -11,7 +11,7 @@ from pathlib import Path
|
||||
|
||||
import click
|
||||
|
||||
ROOT = Path(__file__).parent.parent.resolve()
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
TEST_RESULT_PATH = ROOT / "tests" / "ui_tests" / "reporting" / "reports" / "test"
|
||||
|
||||
|
||||
|
@ -25,9 +25,9 @@ import requests
|
||||
|
||||
from trezorlib import btc, messages, protobuf
|
||||
|
||||
REPOSITORY_ROOT = Path(__file__).parent.parent
|
||||
REPOSITORY_ROOT = Path(__file__).resolve().parent.parent
|
||||
TOOLS_PATH = REPOSITORY_ROOT / "common" / "tools"
|
||||
CACHE_PATH = Path(__file__).parent / "txcache"
|
||||
CACHE_PATH = Path(__file__).resolve().parent / "txcache"
|
||||
|
||||
sys.path.insert(0, str(TOOLS_PATH))
|
||||
from coin_info import coin_info # isort:skip
|
||||
|
@ -11,7 +11,7 @@ from PIL import Image
|
||||
|
||||
from .reporting import testreport
|
||||
|
||||
UI_TESTS_DIR = Path(__file__).parent.resolve()
|
||||
UI_TESTS_DIR = Path(__file__).resolve().parent
|
||||
SCREENS_DIR = UI_TESTS_DIR / "screens"
|
||||
HASH_FILE = UI_TESTS_DIR / "fixtures.json"
|
||||
SUGGESTION_FILE = UI_TESTS_DIR / "fixtures.suggestion.json"
|
||||
|
@ -1,15 +1,15 @@
|
||||
import json
|
||||
import pathlib
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
import requests
|
||||
|
||||
RECORDS_WEBSITE = "https://firmware.corp.sldev.cz/ui_tests/"
|
||||
FIXTURES_MASTER = "https://raw.githubusercontent.com/trezor/trezor-firmware/master/tests/ui_tests/fixtures.json"
|
||||
FIXTURES_CURRENT = pathlib.Path(__file__).parent / "../fixtures.json"
|
||||
FIXTURES_CURRENT = Path(__file__).resolve().parent.parent / "fixtures.json"
|
||||
|
||||
_dns_failed = False
|
||||
|
||||
|
@ -10,8 +10,8 @@ from dominate.tags import br, h1, h2, hr, i, p, table, td, th, tr
|
||||
import download # isort:skip
|
||||
import html # isort:skip
|
||||
|
||||
REPORTS_PATH = Path(__file__).parent.resolve() / "reports" / "master_diff"
|
||||
RECORDED_SCREENS_PATH = Path(__file__).parent.parent.resolve() / "screens"
|
||||
REPORTS_PATH = Path(__file__).resolve().parent / "reports" / "master_diff"
|
||||
RECORDED_SCREENS_PATH = Path(__file__).resolve().parent.parent / "screens"
|
||||
|
||||
|
||||
def get_diff():
|
||||
|
@ -10,7 +10,7 @@ from dominate.util import text
|
||||
|
||||
from . import download, html
|
||||
|
||||
HERE = Path(__file__).parent.resolve()
|
||||
HERE = Path(__file__).resolve().parent
|
||||
REPORTS_PATH = HERE / "reports" / "test"
|
||||
|
||||
STYLE = (HERE / "testreport.css").read_text()
|
||||
|
Loading…
Reference in New Issue
Block a user