删掉回放的五个转发、重复的空格快捷键与重复的等待循环。
回放调用点直接走 replay_ctl,场景工具的路径引导收敛到 _paths,panel_snapshot 复用 panel_check 的 _wait_for,report_from 收成模块私有的 _report_from。
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"""Put the studio and shared source trees on ``sys.path`` for the scene tools.
|
||||
|
||||
These tools are run as scripts out of this directory, but the tests load them by
|
||||
file location (``spec_from_file_location`` + ``exec_module``), which leaves this
|
||||
directory off ``sys.path``. Each tool therefore adds it before importing here.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def bootstrap_paths() -> None:
|
||||
"""Make ``orisys_studio`` and ``orisys_app_shared`` importable from the repo."""
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
@@ -37,13 +37,11 @@ import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Tests load this tool by file location, so add our own directory to the path.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
def _bootstrap_paths() -> None:
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
from _paths import bootstrap_paths # noqa: E402
|
||||
|
||||
|
||||
def _percentiles(values: list[float]) -> dict[str, float]:
|
||||
@@ -604,7 +602,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--json", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
_bootstrap_paths()
|
||||
bootstrap_paths()
|
||||
width, _, height = args.size.partition("x")
|
||||
if args.cpu_only:
|
||||
report, code = measure_cpu(
|
||||
|
||||
@@ -43,13 +43,11 @@ import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Tests load this tool by file location, so add our own directory to the path.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
def _bootstrap_paths() -> None:
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
from _paths import bootstrap_paths # noqa: E402
|
||||
|
||||
|
||||
def _platform_lock_from_args(args):
|
||||
@@ -189,7 +187,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--json", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
_bootstrap_paths()
|
||||
bootstrap_paths()
|
||||
import numpy as np
|
||||
from orisys_app_shared.scene3d.contracts import ThreeDError
|
||||
from orisys_app_shared.scene3d.legacy import LegacyFingerImporter
|
||||
|
||||
@@ -26,20 +26,18 @@ import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Tests load this tool by file location, so add our own directory to the path.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
from _paths import bootstrap_paths # noqa: E402
|
||||
|
||||
#: Exit codes: distinct values so a CI script can tell the two failures apart.
|
||||
EXIT_OK = 0
|
||||
EXIT_SOFTWARE = 3
|
||||
EXIT_NO_CONTEXT = 4
|
||||
|
||||
|
||||
def _bootstrap_paths() -> None:
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
|
||||
|
||||
def collect(profile: str, *, keep_open_s: float) -> dict:
|
||||
"""Create a real window, let Qt initialise it, and report what it got."""
|
||||
from orisys_studio.scene3d.gl_backend import (
|
||||
@@ -189,7 +187,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
)
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
_bootstrap_paths()
|
||||
bootstrap_paths()
|
||||
report = collect(args.profile, keep_open_s=0.6 if args.windowed else 0.3)
|
||||
context = report.get("context")
|
||||
if not context or not context.get("valid"):
|
||||
|
||||
@@ -37,13 +37,11 @@ import threading
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# Tests load this tool by file location, so add our own directory to the path.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
def _bootstrap_paths() -> None:
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
from _paths import bootstrap_paths # noqa: E402
|
||||
|
||||
|
||||
def resident_bytes() -> int:
|
||||
@@ -519,7 +517,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--json", action="store_true")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
_bootstrap_paths()
|
||||
bootstrap_paths()
|
||||
report, code = run(
|
||||
minutes=args.minutes,
|
||||
fps=args.fps,
|
||||
|
||||
@@ -25,13 +25,11 @@ import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# Tests load this tool by file location, so add our own directory to the path.
|
||||
if str(Path(__file__).resolve().parent) not in sys.path:
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
||||
|
||||
def _bootstrap_paths() -> None:
|
||||
here = Path(__file__).resolve()
|
||||
repo = here.parents[2]
|
||||
for path in (repo / "apps" / "studio" / "src", repo / "shared" / "src"):
|
||||
if path.is_dir() and str(path) not in sys.path:
|
||||
sys.path.insert(0, str(path))
|
||||
from _paths import bootstrap_paths # noqa: E402
|
||||
|
||||
|
||||
def _legacy_report(args) -> tuple[int, dict]:
|
||||
@@ -308,7 +306,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--json", action="store_true", help="machine-readable output")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
_bootstrap_paths()
|
||||
bootstrap_paths()
|
||||
if args.legacy_dir is not None:
|
||||
if args.map is None:
|
||||
print("--legacy-dir also needs --map", file=sys.stderr)
|
||||
|
||||
Reference in New Issue
Block a user