From 27ce36badc3f00ec7172c898e43defb12b196c19 Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Fri, 17 Jun 2022 15:30:15 +0200 Subject: [PATCH 1/2] [CONDA] Add pvcam-runtime to test requirements --- conda/camera/meta.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/conda/camera/meta.yaml b/conda/camera/meta.yaml index 3dfd0cf..7112bdd 100644 --- a/conda/camera/meta.yaml +++ b/conda/camera/meta.yaml @@ -38,6 +38,7 @@ test: - test requires: - pytest + - pvcam-runtime imports: - Lima.Iris commands: -- GitLab From 57129a7fdda2b017a8254324fd585145c9e553db Mon Sep 17 00:00:00 2001 From: Samuel Debionne Date: Fri, 17 Jun 2022 15:45:08 +0200 Subject: [PATCH 2/2] Remove pytest tests not possible without a camera --- conda/camera/meta.yaml | 5 --- test/test_api.py | 83 ------------------------------------------ 2 files changed, 88 deletions(-) delete mode 100644 test/test_api.py diff --git a/conda/camera/meta.yaml b/conda/camera/meta.yaml index 7112bdd..46d35c3 100644 --- a/conda/camera/meta.yaml +++ b/conda/camera/meta.yaml @@ -34,15 +34,10 @@ requirements: - pvcam-sdk test: - source_files: - - test requires: - - pytest - pvcam-runtime imports: - Lima.Iris - commands: - - pytest test about: home: https://github.com/esrf-bliss/Lima diff --git a/test/test_api.py b/test/test_api.py deleted file mode 100644 index 180f8c4..0000000 --- a/test/test_api.py +++ /dev/null @@ -1,83 +0,0 @@ -""" -This file can be used with `pytest`. - -The following way to execute the whole tests. -``` -pytest test/test.py -``` - -Or the following way to execute a single test. -``` -pytest test/test.py::test_internal_trigger -``` - -""" - -import time -import logging -from Lima import Core, Iris - - -_logger = logging.getLogger(__name__) - - -class AcquisitionStatusFromImageStatusCallback(Core.CtControl.ImageStatusCallback): - def __init__(self): - super().__init__() - self.last_base_image_ready = -1 - self.last_image_acquired = -1 - self.last_image_ready = -1 - self.last_image_saved = -1 - self.last_counter_ready = -1 - - def imageStatusChanged(self, image_status): - self.last_base_image_ready = image_status.LastBaseImageReady - self.last_image_acquired = image_status.LastImageAcquired - self.last_image_ready = image_status.LastImageReady - self.last_image_saved = image_status.LastImageSaved - self.last_counter_ready = image_status.LastCounterReady - - -def test_internal_trigger(): - cam = Iris.Camera() - hw = Iris.Interface(cam) - ct = Core.CtControl(hw) - -# acq_status = AcquisitionStatusFromImageStatusCallback() -# ct.registerImageStatusCallback(acq_status) - -# ct.prepareAcq() -# ct.startAcq() - -# while ct.getStatus().AcquisitionStatus != Core.AcqReady: -# time.sleep(0.1) - -# assert acq_status.last_image_ready == 0 - assert True - - -#def test_internal_trigger_multi(): -# cam = Iris.Camera() -# hw = Iris.Interface(cam) -# ct = Core.CtControl(hw) - -# acq_status = AcquisitionStatusFromImageStatusCallback() -# ct.registerImageStatusCallback(acq_status) - -# acq = ct.acquisition() -# acq.setTriggerMode(Core.IntTrigMult) -# acq.setAcqNbFrames(3) -# acq.setAcqExpoTime(0.01) - -# ct.prepareAcq() -# for _ in range(3): -# time.sleep(0.1) -# ct.startAcq() -# # Make sure the detector is ready for next image -# while hw.getStatus().acq != Core.AcqReady: -# time.sleep(0.1) - -# while ct.getStatus().AcquisitionStatus != Core.AcqReady: -# time.sleep(0.1) - -# assert acq_status.last_image_ready == 2 -- GitLab