from types import ModuleType import numpy as np from numpy.testing import assert_equal from ..base import open _log = logging.getLogger(__name__) # hijack cothread assert 'cothread' not in sys.modules CM = ModuleType('cothread') sys.modules['cothread'] = CM CM.Event = object CA = ModuleType('cothread.catools') sys.modules['cothread.catools'] = CA _PVs = {} CA.FORMAT_TIME = 1 CA.DBR_CHAR_STR = 2 def caget(name, timeout=None): return _PVs[name] CA.caget = caget