コード例 #1
0
def cl_selector(request):
    cl_name = request.param
    if cl_name == 'caproto':
        pytest.importorskip('caproto')
    elif cl_name == 'pyepics':
        pytest.importorskip('epics')
    set_cl(cl_name)
    yield
    set_cl()
コード例 #2
0
ファイル: conftest.py プロジェクト: NSLS-II/ophyd
def cl_selector(request):
    cl_name = request.param
    if cl_name == 'caproto':
        pytest.importorskip('caproto')
        logging.getLogger('caproto.bcast').setLevel('INFO')
    elif cl_name == 'pyepics':
        pytest.importorskip('epics')
    set_cl(cl_name)
    yield
    set_cl()
コード例 #3
0
ファイル: conftest.py プロジェクト: awalter-bnl/ophyd
def cl_selector(request):
    cl_name = request.param
    if cl_name == 'caproto':
        pytest.importorskip('caproto')
        logging.getLogger('caproto.bcast').setLevel('INFO')
    elif cl_name == 'pyepics':
        pytest.importorskip('epics')
    set_cl(cl_name)
    yield
    set_cl()
コード例 #4
0
def patch_and_use_dummy_shim():
    """
    Hack ophyd and its dummy shim.  We don't want _any_ control-layer
    connections being made while we're looking for signals.

    Warning
    -------
    Under no circumstances should this be used in a production environment
    where you intend to actually _use_ ophyd for its intended purpose.
    """
    ophyd.Device.lazy_wait_for_connection = False

    def _no_op(*args, **kwargs):
        ...

    class _PVStandIn:
        _reference_count = 0

        def __init__(self, pvname, *args, **kwargs):
            self.pvname = pvname
            self.connected = True

        add_callback = _no_op
        remove_callback = _no_op
        clear_callbacks = _no_op
        get = _no_op
        put = _no_op
        get_with_metadata = _no_op
        wait_for_connection = _no_op

    def get_pv(pvname, *args, **kwargs):
        return _PVStandIn(pvname)

    from ophyd import _dummy_shim

    _dummy_shim.get_pv = get_pv
    _dummy_shim.release_pvs = _no_op
    ophyd.set_cl("dummy")