Skip to content

Commit 4de155a

Browse files
committed
Stabilize Basler timeout mapping test
Update the hardware-trigger timeout test to raise `bb.genicam.TimeoutException` directly instead of a fake timeout class, and assert that this real pylon exception is preserved as the `__cause__` of the mapped `TimeoutError`. This keeps the test aligned with actual backend behavior.
1 parent 146d81a commit 4de155a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/cameras/backends/test_basler_backend.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,10 @@ class FakePylonTimeout(Exception):
487487
backend = bb.BaslerCameraBackend(settings)
488488
backend.open()
489489

490+
pylon_to = bb.genicam.TimeoutException
491+
490492
def raise_timeout(*_args, **_kwargs):
491-
raise FakePylonTimeout("Grab timed out")
493+
raise pylon_to("Simulated timeout")
492494

493495
monkeypatch.setattr(backend._camera, "RetrieveResult", raise_timeout)
494496

@@ -499,7 +501,7 @@ def raise_timeout(*_args, **_kwargs):
499501
) as exc_info:
500502
backend.read()
501503

502-
assert isinstance(exc_info.value.__cause__, FakePylonTimeout)
504+
assert isinstance(exc_info.value.__cause__, bb.genicam.TimeoutException)
503505

504506
finally:
505507
backend.close()

0 commit comments

Comments
 (0)