test: add test for dispatch against each plugin
CI / lint (pull_request) Successful in 1m17s
CI / test (3.12) (pull_request) Successful in 1m13s
CI / test (3.11) (pull_request) Successful in 1m55s
CI / test (3.13) (pull_request) Successful in 2m6s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Failing after 53s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 51s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m5s
CI / test-with-coverage (pull_request) Skipped
CI / lint (pull_request) Successful in 1m17s
CI / test (3.12) (pull_request) Successful in 1m13s
CI / test (3.11) (pull_request) Successful in 1m55s
CI / test (3.13) (pull_request) Successful in 2m6s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Failing after 53s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 51s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Failing after 1m5s
CI / test-with-coverage (pull_request) Skipped
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import importlib
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from aare.beamline_dispatch.beamline_dispatch import get_beamline_dispatch
|
||||
from aare.beamline_dispatch.simulated import SimulatedDispatch
|
||||
from aare.beamline_dispatch.x06da.beamline_dispatch import X06daDispatch
|
||||
from aare.beamline_dispatch.x06sa import X06saDispatch
|
||||
from aare.beamline_dispatch.x10sa import X10saDispatch
|
||||
|
||||
|
||||
def test_dispatch_cannot_be_instantiated_without_env():
|
||||
with patch.dict("os.environ", {}, clear=True):
|
||||
with pytest.raises(ValueError) as e:
|
||||
_ = get_beamline_dispatch()
|
||||
assert e.match("Please set the BEAMLINE environment variable")
|
||||
|
||||
|
||||
def test_simulated_dispatch_can_be_instantiated():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "SIMULATED"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert isinstance(dispatch, SimulatedDispatch)
|
||||
|
||||
|
||||
@pytest.mark.skipif(importlib.util.find_spec("pxi_bec") is None, reason="run only for pxi flavour")
|
||||
def test_pxi_dispatch_can_be_instantiated():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X06SA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert isinstance(dispatch, X06saDispatch)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxii_bec") is None, reason="run only for pxii flavour"
|
||||
)
|
||||
def test_pxii_dispatch_can_be_instantiated():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X10SA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert isinstance(dispatch, X10saDispatch)
|
||||
|
||||
|
||||
@pytest.mark.skipif(
|
||||
importlib.util.find_spec("pxiii_bec") is None, reason="run only for pxiii flavour"
|
||||
)
|
||||
def test_pxiii_dispatch_can_be_instantiated():
|
||||
with patch.dict("os.environ", {"BEAMLINE": "X06DA"}):
|
||||
dispatch = get_beamline_dispatch()
|
||||
assert isinstance(dispatch, X06daDispatch)
|
||||
Reference in New Issue
Block a user