added ruff test

This commit is contained in:
ykcheungab
2026-09-27 19:20:43 +08:00
parent bcab2790bf
commit fa2703968e
178 changed files with 3277 additions and 1034 deletions
+16 -12
View File
@@ -18,6 +18,7 @@ import sys
import threading
import time
from pathlib import Path
APP_ROOT = Path(__file__).resolve().parents[1]
REPO_ROOT = APP_ROOT.parents[1]
for _path in (APP_ROOT / "src", REPO_ROOT / "shared" / "src"):
@@ -185,7 +186,6 @@ def _fake_packet(
something visible (see ``ui_snapshot --scene replay``).
"""
import numpy as np
from orisys_app_shared.acquisition.sdk_worker import SdkPacket
nan = float("nan")
@@ -558,12 +558,10 @@ def audit_palette(verbose: bool = False) -> list[str]:
def main() -> int:
from PySide6.QtWidgets import QApplication
from orisys_app_shared.force.calibration_io import CalSample
from orisys_app_shared.i18n import set_locale, t
from orisys_app_shared.theme import build_qss, load_colors
from orisys_studio.app_window import VIEW_SPLITTER_SIZES, StudioMainWindow
from orisys_studio.app_window import StudioMainWindow
from PySide6.QtWidgets import QApplication
app = QApplication.instance() or QApplication(sys.argv)
set_locale("zh_CN")
@@ -768,12 +766,14 @@ def main() -> int:
window.cal_panel.table.item(1, 5).text() == t("cal.state_excluded"),
"the excluded row does not show its state",
)
import orisys.calibration as _sdk_calibration
from orisys_app_shared.force.calibration_io import (
build_export_model,
build_force_calibration_v2 as _build_v2,
predict_channel,
)
import orisys.calibration as _sdk_calibration
from orisys_app_shared.force.calibration_io import (
build_force_calibration_v2 as _build_v2,
)
store = window.cal_panel._store
model = build_export_model(
@@ -1798,6 +1798,7 @@ def main() -> int:
section("acquisition correctness")
import csv as _csv
import shutil as _shutil
import numpy as np
# A device that only confirms its calibration a moment after the first
@@ -2090,6 +2091,10 @@ def main() -> int:
env=env,
capture_output=True,
timeout=60,
# Deliberately not ``check=True``: a non-zero exit *is* one of the things
# being measured here (a crash on shutdown), and it is reported through
# this checker's own ``check()`` below rather than as a traceback.
check=False,
)
elapsed = time.perf_counter() - started
print(f" window closed and the process returned in {elapsed:.1f}s")
@@ -2326,17 +2331,18 @@ def main() -> int:
import json as _cal_json
from unittest.mock import patch as _patch_mismatch
import orisys_studio.ui.cal_panel as _cal_panel_module
import orisys_studio.calibration_service as _cal_service_module
from PySide6.QtWidgets import QMessageBox as _QMessageBox
import orisys_studio.ui.cal_panel as _cal_panel_module
from orisys_app_shared.force.calibration_io import (
build_force_calibration_v2 as _build_v2b,
)
from orisys_app_shared.force.calibration_io import (
write_force_calibration as _write_cal,
)
from orisys_app_shared.force.calibration_session import (
build_session_document as _build_session_doc,
)
from PySide6.QtWidgets import QMessageBox as _QMessageBox
record_dir = APP_ROOT / "outputs" / "_cal_record_check"
if record_dir.exists():
@@ -3065,7 +3071,6 @@ def main() -> int:
recorder.on_packet(_fake_packet(index))
recorder.stop()
from orisys_studio.replay import ReplayEngine
# The replay lives in the main window: one engine, one progress bar, and the
# charts read the recording itself.
@@ -3314,7 +3319,6 @@ def main() -> int:
# Long-history browsing: an interval read is bounded by the interval, and the
# whole-session envelope is a band rather than every row.
from orisys_app_shared.force.source import RecordingCurveSource
from orisys_app_shared.record.index import RecordingIndex
from orisys_app_shared.record.playback import RecordingReader as _RecordingReader
reader = _RecordingReader(recording, max_rows=10)