37 lines
836 B
Python
37 lines
836 B
Python
import os
|
|
import sys
|
|
import types
|
|
from unittest.mock import MagicMock
|
|
|
|
import pytest
|
|
from PySide6.QtWidgets import QApplication
|
|
|
|
from aare.common.models import SampleShortInfo, DewarAddress
|
|
|
|
# Ensure safe defaults during tests
|
|
os.environ.setdefault("BEAMLINE", "SIMULATED")
|
|
os.environ.setdefault("QT_QPA_PLATFORM", "offscreen")
|
|
|
|
# -------------------------
|
|
# Qt app fixture
|
|
# -------------------------
|
|
@pytest.fixture(scope="session")
|
|
def qapp():
|
|
app = QApplication.instance()
|
|
if app is None:
|
|
app = QApplication(sys.argv)
|
|
return app
|
|
|
|
|
|
@pytest.fixture
|
|
def sample_info():
|
|
return SampleShortInfo(
|
|
db_id=1,
|
|
puck_name="puck1",
|
|
dewar_name="dew1",
|
|
sample_name="sample1",
|
|
run_number=1,
|
|
user="group1",
|
|
pin=3,
|
|
location=DewarAddress(segment="A", pos=2),
|
|
) |