Phase 0: test scaffolding + golden fixtures
- ruff config, offscreen smoke tests for all 7 GUI apps/panels - golden v6 .sras fixtures (complete + 4 truncation variants) generated by the pre-refactor writer, with expected header/frontier JSON - golden geometry fixtures from the pre-refactor _build_scan_params - consistency tests proving current code reproduces the goldens Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
"""Shared test setup: repo-root imports, headless Qt, pyueye stub.
|
||||
|
||||
The IDS uEye SDK (pyueye + libueye) only exists on the Linux rig. On any
|
||||
other machine we stub the module before hardware.uc480_camera is imported;
|
||||
everything in uc480_camera references `ueye.*` at call time, not import
|
||||
time, so an attribute-permissive dummy is sufficient for constructing
|
||||
windows and importing modules.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
if str(ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
||||
|
||||
try:
|
||||
import pyueye # noqa: F401
|
||||
except ImportError:
|
||||
class _UeyeStub:
|
||||
"""Permissive attribute sink standing in for pyueye.ueye."""
|
||||
IS_SUCCESS = 0
|
||||
|
||||
def __getattr__(self, name):
|
||||
return _UeyeStub()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return _UeyeStub()
|
||||
|
||||
def __or__(self, other):
|
||||
return 0
|
||||
|
||||
def __ror__(self, other):
|
||||
return 0
|
||||
|
||||
_pyueye = types.ModuleType("pyueye")
|
||||
_pyueye.ueye = _UeyeStub()
|
||||
sys.modules["pyueye"] = _pyueye
|
||||
Reference in New Issue
Block a user