util
Fixtures
“Factory as fixture”
Functions
Classes
- get_marker_attrs(request)[source]
Return python attr values corresponding to the fixture.
Must be called from within the fixture code.
Python attrs must be passed using
pytestmarker e.g.:@pytest.mark.attrs({"pool": {"drift_correction": False}}) def test_pool(pool): assert pool.drift_correction = False
- get_marker_attribute_values(request)[source]
Return attribute values corresponding to the fixture.
Must be called from within the fixture code.
Attribute values must be passed using
pytestmarker e.g.:@pytest.mark.attribute_values({"mot01": {"Offset": 1.23}}) def test_motor(mot01): assert mot01.offset = 1.23
- get_marker_kwargs(request)[source]
Return creation kwargs corresponding to the fixture.
Must be called from within the fixture code.
Attribute values must be passed using
pytestmarker e.g.:@pytest.mark.kwargs({"motctrl01" {"properties": {"Prop2": 123}}}}) def test_motctrl(motctrl01): assert motctrl01.ctrl.Prop2 == 123
- pool(create_pool, request)[source]
Return a
Poolobject.By default it is loaded with built-in controller plugins. Can be customized with
attrsandkwargsmarkers.
- motctrl01(create_motor_ctrl, request)[source]
Return a
PoolControllerobject of motor type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- mot01(create_motor, motctrl01, request)
Return a
PoolMotorobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by themotctrl01fixture.
- mot02(create_motor, motctrl01, request)
Return a
PoolMotorobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by themotctrl01fixture.
- mot03(create_motor, motctrl01, request)
Return a
PoolMotorobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by themotctrl01fixture.
- mot04(create_motor, motctrl01, request)
Return a
PoolMotorobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by themotctrl01fixture.
- ctctrl01(create_counter_timer_ctrl, request)[source]
Return a
PoolControllerobject of counter/timer type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- ct01(create_counter_timer, ctctrl01, request)
Return a
PoolCounterTimerobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thectctrl01fixture.
- ct02(create_counter_timer, ctctrl01, request)
Return a
PoolCounterTimerobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thectctrl01fixture.
- ct03(create_counter_timer, ctctrl01, request)
Return a
PoolCounterTimerobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thectctrl01fixture.
- ct04(create_counter_timer, ctctrl01, request)
Return a
PoolCounterTimerobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thectctrl01fixture.
- zerodctrl01(create_zerod_ctrl, request)[source]
Return a
PoolControllerobject of 0D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- zerod01(create_zerod, zerodctrl01, request)
Return a
Pool0DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thezerodctrl01fixture.
- zerod02(create_zerod, zerodctrl01, request)
Return a
Pool0DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thezerodctrl01fixture.
- zerod03(create_zerod, zerodctrl01, request)
Return a
Pool0DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thezerodctrl01fixture.
- zerod04(create_zerod, zerodctrl01, request)
Return a
Pool0DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thezerodctrl01fixture.
- onedctrl01(create_oned_ctrl, request)[source]
Return a
PoolControllerobject of 1D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- oned01(create_oned, onedctrl01, request)
Return a
Pool1DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by theonedctrl01fixture.
- twodctrl01(create_twod_ctrl, request)[source]
Return a
PoolControllerobject of 2D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- twod01(create_twod, twodctrl01, request)
Return a
Pool2DExpChannelobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thetwodctrl01fixture.
- iorctrl01(create_ior_ctrl, request)[source]
Return a
PoolControllerobject of IORegister type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- ior01(create_ior, iorctrl01, request)
Return a
PoolIORegisterobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by theiorctrl01fixture.
- ior02(create_ior, iorctrl01, request)
Return a
PoolIORegisterobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by theiorctrl01fixture.
- tgctrl01(create_tg_ctrl, request)[source]
Return a
PoolControllerobject of TriggerGate type. By default it uses the dummy controller plugin. It resides in the pool object returned by thepoolfixture.
- tg01(create_tg, tgctrl01, request)
Return a
PoolTriggerGateobject which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by thetgctrl01fixture.
- slitctrl01(create_pseudo_motor_ctrl, mot01, mot02, request)[source]
Return a
PoolPseudoMotorControllerobject. By default it uses the slit controller plugin. It resides in the pool object returned by thepoolfixture.
- gap01(create_pseudo_motor, slitctrl01, request)[source]
Return a
PoolPseudoMotorobject corresponding to the Gap role. It is handled by the controller object returned by theslitctrl01fixture.
- offset01(create_pseudo_motor, slitctrl01, request)[source]
Return a
PoolPseudoMotorobject corresponding to the Offset role. It is handled by the controller object returned by theslitctrl01fixture.
- motgrp0102(create_motor_group, mot01, mot02, request)[source]
Return a
PoolMotorGroupobject handling motors returned by themot01andmot02fixtures. It resides in the pool object returned by thepoolfixture.
- mntgrp01(create_measurement_group, ct01, ct02, ct03, ct04, request)[source]
Return a
PoolMeasurementGroupobject containing four CounterTimer channels returned by thect01,ct02,ct03andct04fixtures. It resides in the pool object returned by thepoolfixture.
- create_pool()[source]
“Factory as fixture” for creating
Poolobjects.Can be used to create fixtures or directly from tests:
def test_pool(create_pool): pool = create_pool() pool.pool_path = "/path/to/tour/controller/classes"
- create_ctrl(pool)[source]
“Factory as fixture” for creating
PoolControllerobjects.Can be used to create fixtures or directly from tests:
def test_ctrl(create_ctrl): kwargs = { "name": "motctrl01", "klass": "TangoAttrMotorController", "library": "TangoAttrMotorCtrl.py" "type": "Motor", "properties": {} } ctrl = create_ctrl(kwargs) assert ctrl.is_online() == True
- create_motor_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of motor type.Can be used to create fixtures or directly from tests:
def test_motor_ctrl(create_motor_ctrl): kwargs = { "klass": "TangoAttrMotorController", "library": "TangoAttrMotorCtrl.py" } ctrl = create_motor_ctrl(kwargs) assert ctrl.is_online() == True
- create_counter_timer_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of counter/timer type.Can be used to create fixtures or directly from tests:
def test_counter_timer_ctrl(create_counter_timer_ctrl): kwargs = { "klass": "TangoAttrCTController", "library": "TangoAttrCTCtrl.py" } ctrl = create_counter_timer_ctrl(kwargs) assert ctrl.is_online() == True
- create_zerod_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of 0D experimental channel type.Can be used to create fixtures or directly from tests:
def test_zerod_ctrl(create_zerod_ctrl): kwargs = { "klass": "TangoAttrZeroDController", "library": "TangoAttrZeroDCtrl.py" } ctrl = create_zerod_ctrl(kwargs) assert ctrl.is_online() == True
- create_oned_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of 1D experimental channel type.Can be used to create fixtures or directly from tests:
def test_oned_ctrl(create_oned_ctrl): kwargs = { "klass": "OneDController", "library": "OneDCtrl.py" } ctrl = create_oned_ctrl(kwargs) assert ctrl.is_online() == True
- create_twod_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of 2D experimental channel type.Can be used to create fixtures or directly from tests:
def test_twod_ctrl(create_twod_ctrl): kwargs = { "klass": "TwoDController", "library": "TwoDCtrl.py" } ctrl = create_twod_ctrl(kwargs) assert ctrl.is_online() == True
- create_ior_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of IORegister type.Can be used to create fixtures or directly from tests:
def test_ior_ctrl(create_ior_ctrl): kwargs = { "klass": "TangoAttrIORController", "library": "TangoAttrIORCtrl.py" } ctrl = create_ior_ctrl(kwargs) assert ctrl.is_online() == True
- create_tg_ctrl(create_ctrl)[source]
“Factory as fixture” for creating
PoolControllerobjects of TriggerGate type.Can be used to create fixtures or directly from tests:
def test_tg_ctrl(create_tg_ctrl): kwargs = { "klass": "TriggerGateController", "library": "TriggerGateCtrl.py" } ctrl = create_tg_ctrl(kwargs) assert ctrl.is_online() == True
- create_element(request)[source]
“Factory as fixture” for creating
PoolElementobjects.Can be used to create fixtures or directly from tests:
def test_element(motctrl01, create_element): kwargs = { "type": "Motor", "name": "mot01", "ctrl_id": motctrl01.id, "axis": 1 } element = create_element(kwargs) assert element.state == State.On
- create_motor(create_element)[source]
“Factory as fixture” for creating
PoolMotorobjects.Can be used to create fixtures or directly from tests:
def test_motor(motctrl01, create_motor): motor = create_motor(motctrl01, axis=6) assert motor.state == State.On
- create_counter_timer(create_element)[source]
“Factory as fixture” for creating
PoolCounterTimerobjects.Can be used to create fixtures or directly from tests:
def test_counter_timer(ctctrl01, create_counter_timer): ct = create_counter_timer(ctctrl01, axis=1) assert ct.state == State.On
- create_zerod(create_element)[source]
“Factory as fixture” for creating
Pool0DExpChannelobjects.Can be used to create fixtures or directly from tests:
def test_zerod(zerodctrl01, create_zerod): zerod = create_zerod(zerodctrl01, axis=1) assert zerod.state == State.On
- create_oned(create_element)[source]
“Factory as fixture” for creating
Pool1DExpChannelobjects.Can be used to create fixtures or directly from tests:
def test_oned(onedctrl01, create_oned): oned = create_oned(onedctrl01, axis=1) assert oned.state == State.On
- create_twod(create_element)[source]
“Factory as fixture” for creating
Pool2DExpChannelobjects.Can be used to create fixtures or directly from tests:
def test_twod(twodctrl01, create_twod): twod = create_twod(twodctrl01, axis=1) assert twod.state == State.On
- create_ior(create_element)[source]
“Factory as fixture” for creating
PoolIORegisterobjects.Can be used to create fixtures or directly from tests:
def test_ior(iorctrl01, create_ior): ior = create_ior(iorctrl01, axis=1) assert ior.state == State.On
- create_tg(create_element)[source]
“Factory as fixture” for creating
PoolTriggerGateobjects.Can be used to create fixtures or directly from tests:
def test_tg(tgctrl01, create_ior): tg = create_tg(tgctrl01, axis=1) assert tg.state == State.On
- create_motor_group()[source]
“Factory as fixture” for creating
PoolMotorGroupobjects.Can be used to create fixtures or directly from tests:
def test_motor_group(create_motor_group, mot01, mot02): motgrp = create_motor_group([mot01, mot02]]) assert motgrp.state == State.On
- create_measurement_group()[source]
“Factory as fixture” for creating
PoolMeasurementGroupobjects.Can be used to create fixtures or directly from tests:
def test_measurement_group(create_measurement_group, ct01, ct02): mntgrp = create_measurement_group([ct01, ct02]]) assert mntgrp.state == State.On
- class ActionEvent(element)[source]
Helper class for synchronizing tests with background actions.
Can be used for synchronizing actions start and finish events:
def test_motor_motion(mot01): motion_event = ActionEvent(mot01) mot01.position = 10 motion_event.started.wait(1) # here you could do some stuff motion_event.done.wait(1) assert mot01.position.value == 10