diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ce235adb..6d835da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: defaults: run: shell: bash -l {0} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 strategy: max-parallel: 5 steps: @@ -29,8 +29,8 @@ jobs: uses: mamba-org/setup-micromamba@v1 with: environment-file: environment.yml - - name: Setup X virtual frame buffer - run: Xvfb $DISPLAY & + # - name: Setup X virtual frame buffer + # run: Xvfb $DISPLAY & - name: Install haven run: pip install -e . - name: Environment info @@ -45,4 +45,4 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Test with pytest - run: pytest --timeout=120 src/firefly/tests/test_run_browser.py src/firefly/tests/test_voltmeters.py src/firefly/tests/test_xrf_detector_display.py + run: xvfb-run python -m pytest -vv --timeout=120 src/firefly/tests/test_run_browser.py src/firefly/tests/test_voltmeters.py src/firefly/tests/test_xrf_detector_display.py diff --git a/src/firefly/application.py b/src/firefly/application.py index 56d106bf..a8846cac 100644 --- a/src/firefly/application.py +++ b/src/firefly/application.py @@ -265,10 +265,7 @@ def _prepare_device_windows(self, device_label: str, attr_name: str): window_slots = [] setattr(self, f"{attr_name}_window_slots", window_slots) setattr(self, f"{attr_name}_windows", {}) - # if attr_name == "ion_chamber": - # breakpoint() for device in devices: - # Check that we don't already have actions set # Create the window action action = QtWidgets.QAction(self) action.setObjectName(f"actionShow_{attr_name}_{device.name}") diff --git a/src/firefly/tests/test_xrf_detector_display.py b/src/firefly/tests/test_xrf_detector_display.py index e256d355..e90f1496 100644 --- a/src/firefly/tests/test_xrf_detector_display.py +++ b/src/firefly/tests/test_xrf_detector_display.py @@ -10,6 +10,9 @@ from firefly.xrf_roi import XRFROIDisplay +detectors = ['xspress',] + + @pytest.fixture() def xrf_display(ffapp, request): """Parameterized fixture for creating a display based on a specific @@ -29,10 +32,10 @@ def xrf_display(ffapp, request): plot_widget.update_spectrum(1, spectra[1]) plot_widget.update_spectrum(2, spectra[2]) plot_widget.update_spectrum(3, spectra[3]) - return display + yield display -@pytest.mark.parametrize("det_fixture", ["dxp", "xspress"]) +@pytest.mark.parametrize("det_fixture", detectors) def test_open_xrf_detector_viewer_actions(ffapp, qtbot, det_fixture, request): sim_det = request.getfixturevalue(det_fixture) # Get the area detector parts ready @@ -44,7 +47,7 @@ def test_open_xrf_detector_viewer_actions(ffapp, qtbot, det_fixture, request): assert "FireflyMainWindow_xrf_detector_vortex_me4" in ffapp.windows.keys() -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_roi_widgets(xrf_display): xrf_display.draw_roi_widgets(2) # Check that the widgets were drawn @@ -52,7 +55,7 @@ def test_roi_widgets(xrf_display): disp = xrf_display.roi_displays[0] -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_roi_element_comboboxes(ffapp, qtbot, xrf_display): # Check that the comboboxes have the right number of entries element_cb = xrf_display.ui.mca_combobox @@ -61,7 +64,7 @@ def test_roi_element_comboboxes(ffapp, qtbot, xrf_display): assert roi_cb.count() == xrf_display.device.num_rois -@pytest.mark.parametrize("det_fixture", ["dxp", "xspress"]) +@pytest.mark.parametrize("det_fixture", detectors) def test_roi_selection(ffapp, qtbot, det_fixture, request): det = request.getfixturevalue(det_fixture) display = XRFROIDisplay(macros={"DEV": det.name, "NUM": 2, "MCA": 2, "ROI": 2}) @@ -78,7 +81,7 @@ def test_roi_selection(ffapp, qtbot, det_fixture, request): assert f"background: {display.selected_background}" not in display.styleSheet() -@pytest.mark.parametrize("xrf_display", ["dxp", "xspress"], indirect=True) +@pytest.mark.parametrize("xrf_display", detectors, indirect=True) def test_all_rois_selection(xrf_display): """Are all the other ROIs disabled when one is selected?""" roi_display = xrf_display.roi_displays[0] diff --git a/src/haven/instrument/xspress.py b/src/haven/instrument/xspress.py index 3dea0ca2..dc63e9b4 100644 --- a/src/haven/instrument/xspress.py +++ b/src/haven/instrument/xspress.py @@ -81,30 +81,30 @@ class ChannelSignal(MultiDerivedSignal): """A high/low range limit channel for an ROI.""" - def set( - self, - value: OphydDataType, - *, - timeout: Optional[float] = None, - settle_time: Optional[float] = None, - ) -> StatusBase: - # Check for existing signals and, if necessary, wait them out - signals = [ - self.parent.hi_chan, - self.parent.lo_chan, - self.parent.size, - self.parent._lo_chan, - ] - - def get_threads(): - thds = [sig._set_thread for sig in signals if sig._set_thread] - return [th for th in thds if th is not None] - - while len(threads := get_threads()) > 0: - for th in threads: - th.join() - # Set the signal like normal - return super().set(value, timeout=timeout, settle_time=settle_time) + # def set( + # self, + # value: OphydDataType, + # *, + # timeout: Optional[float] = None, + # settle_time: Optional[float] = None, + # ) -> StatusBase: + # # Check for existing signals and, if necessary, wait them out + # signals = [ + # self.parent.hi_chan, + # self.parent.lo_chan, + # self.parent.size, + # self.parent._lo_chan, + # ] + + # def get_threads(): + # thds = [sig._set_thread for sig in signals if sig._set_thread] + # return [th for th in thds if th is not None] + + # while len(threads := get_threads()) > 0: + # for th in threads: + # th.join() + # # Set the signal like normal + # return super().set(value, timeout=timeout, settle_time=settle_time) class ROI(ROIMixin):