util

Fixtures

“Factory as fixture”

Functions

Classes

set_obj_attrs(obj, attrs)[source]

Set multiple attributes to an object using setattr

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 pytest marker 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 pytest marker 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 pytest marker 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 Pool object.

By default it is loaded with built-in controller plugins. Can be customized with attrs and kwargs markers.

motctrl01(create_motor_ctrl, request)[source]

Return a PoolController object of motor type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

mot01(create_motor, motctrl01, request)

Return a PoolMotor object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the motctrl01 fixture.

mot02(create_motor, motctrl01, request)

Return a PoolMotor object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the motctrl01 fixture.

mot03(create_motor, motctrl01, request)

Return a PoolMotor object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the motctrl01 fixture.

mot04(create_motor, motctrl01, request)

Return a PoolMotor object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the motctrl01 fixture.

ctctrl01(create_counter_timer_ctrl, request)[source]

Return a PoolController object of counter/timer type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

ct01(create_counter_timer, ctctrl01, request)

Return a PoolCounterTimer object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the ctctrl01 fixture.

ct02(create_counter_timer, ctctrl01, request)

Return a PoolCounterTimer object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the ctctrl01 fixture.

ct03(create_counter_timer, ctctrl01, request)

Return a PoolCounterTimer object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the ctctrl01 fixture.

ct04(create_counter_timer, ctctrl01, request)

Return a PoolCounterTimer object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the ctctrl01 fixture.

zerodctrl01(create_zerod_ctrl, request)[source]

Return a PoolController object of 0D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

zerod01(create_zerod, zerodctrl01, request)

Return a Pool0DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the zerodctrl01 fixture.

zerod02(create_zerod, zerodctrl01, request)

Return a Pool0DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the zerodctrl01 fixture.

zerod03(create_zerod, zerodctrl01, request)

Return a Pool0DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the zerodctrl01 fixture.

zerod04(create_zerod, zerodctrl01, request)

Return a Pool0DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the zerodctrl01 fixture.

onedctrl01(create_oned_ctrl, request)[source]

Return a PoolController object of 1D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

oned01(create_oned, onedctrl01, request)

Return a Pool1DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the onedctrl01 fixture.

twodctrl01(create_twod_ctrl, request)[source]

Return a PoolController object of 2D experimental channel type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

twod01(create_twod, twodctrl01, request)

Return a Pool2DExpChannel object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the twodctrl01 fixture.

iorctrl01(create_ior_ctrl, request)[source]

Return a PoolController object of IORegister type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

ior01(create_ior, iorctrl01, request)

Return a PoolIORegister object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the iorctrl01 fixture.

ior02(create_ior, iorctrl01, request)

Return a PoolIORegister object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the iorctrl01 fixture.

tgctrl01(create_tg_ctrl, request)[source]

Return a PoolController object of TriggerGate type. By default it uses the dummy controller plugin. It resides in the pool object returned by the pool fixture.

tg01(create_tg, tgctrl01, request)

Return a PoolTriggerGate object which axis number is determined from the last two digits of the fixture name. It is handled by the controller object returned by the tgctrl01 fixture.

slitctrl01(create_pseudo_motor_ctrl, mot01, mot02, request)[source]

Return a PoolPseudoMotorController object. By default it uses the slit controller plugin. It resides in the pool object returned by the pool fixture.

gap01(create_pseudo_motor, slitctrl01, request)[source]

Return a PoolPseudoMotor object corresponding to the Gap role. It is handled by the controller object returned by the slitctrl01 fixture.

offset01(create_pseudo_motor, slitctrl01, request)[source]

Return a PoolPseudoMotor object corresponding to the Offset role. It is handled by the controller object returned by the slitctrl01 fixture.

motgrp0102(create_motor_group, mot01, mot02, request)[source]

Return a PoolMotorGroup object handling motors returned by the mot01 and mot02 fixtures. It resides in the pool object returned by the pool fixture.

create_pool()[source]

“Factory as fixture” for creating Pool objects.

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 PoolController objects.

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 PoolController objects 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 PoolController objects 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 PoolController objects 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 PoolController objects 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 PoolController objects 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 PoolController objects 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 PoolController objects 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 PoolElement objects.

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 PoolMotor objects.

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 PoolCounterTimer objects.

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 Pool0DExpChannel objects.

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 Pool1DExpChannel objects.

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 Pool2DExpChannel objects.

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 PoolIORegister objects.

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 PoolTriggerGate objects.

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
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