def setUp(self): self._path_manager = PathManager() self._path_manager.dataPath = "." self._persistenceLayer = PersistenceLayer( pathManager=self._path_manager) self.deviceManager = DeviceManager(self._persistenceLayer) #yield self._persistenceLayer.setup() yield self.deviceManagers.setup()
def __init__(self,parent = None, persistenceLayer= None, name="home",description="Add Description here",status="active",*args,**kwargs): BaseComponent.__init__(self, parent) self._persistenceLayer = persistenceLayer self.name=name self.description=description self.status=status self._devices=DeviceManager(self) self._tasks=TaskManager(self)
class Test_device_manager(unittest.TestCase): @defer.inlineCallbacks def setUp(self): self._path_manager = PathManager() self._path_manager.dataPath = "." self._persistenceLayer = PersistenceLayer( pathManager=self._path_manager) self.deviceManager = DeviceManager(self._persistenceLayer) #yield self._persistenceLayer.setup() yield self.deviceManagers.setup() def tearDown(self): self.deviceManager.teardown() self._persistenceLayer.tearDown() if os.path.exists("pollapli.db"): os.remove("pollapli.db")
def setUp(self): self._path_manager = PathManager() self._path_manager.dataPath = "." self._persistenceLayer = PersistenceLayer(pathManager = self._path_manager) self.deviceManager=DeviceManager(self._persistenceLayer) #yield self._persistenceLayer.setup() yield self.deviceManagers.setup()
class Test_device_manager(unittest.TestCase): @defer.inlineCallbacks def setUp(self): self._path_manager = PathManager() self._path_manager.dataPath = "." self._persistenceLayer = PersistenceLayer(pathManager = self._path_manager) self.deviceManager=DeviceManager(self._persistenceLayer) #yield self._persistenceLayer.setup() yield self.deviceManagers.setup() def tearDown(self): self.deviceManager.teardown() self._persistenceLayer.tearDown() if os.path.exists("pollapli.db"): os.remove("pollapli.db")
def __init__( self, parent=None, persistenceLayer=None, name="home", description="Add Description here", status="active", *args, **kwargs ): BaseComponent.__init__(self, parent) self._persistenceLayer = persistenceLayer self.name = name self.description = description self.status = status self._devices = DeviceManager(self) self._tasks = TaskManager(self)
class Environment(BaseComponent): def __init__(self,parent = None, persistenceLayer= None, name="home",description="Add Description here",status="active",*args,**kwargs): BaseComponent.__init__(self, parent) self._persistenceLayer = persistenceLayer self.name=name self.description=description self.status=status self._devices=DeviceManager(self) self._tasks=TaskManager(self) def __eq__(self, other): return self.cid == other.cid and self.name == other.name and self.description == other.description and self.status == other.status def __ne__(self, other): return not self.__eq__(other) def __str__(self): return "%s %s %s" %(self.name,self.description,self.status) def __getattr__(self, attr_name): if hasattr(self._devices, attr_name): return getattr(self._devices, attr_name) elif hasattr(self._tasks, attr_name): return getattr(self._tasks, attr_name) else: raise AttributeError(attr_name) """ #################################################################################### Configuration and shutdown methods """ @defer.inlineCallbacks def setup(self): """ Method configuring additional elements of the current environment """ yield self._devices.setup() yield self._tasks.setup() log.msg("Environment ",self.name ,"with id", self.cid," setup correctly", logLevel=logging.CRITICAL, system="environment") def teardown(self): """
class Environment(BaseComponent): def __init__( self, parent=None, persistenceLayer=None, name="home", description="Add Description here", status="active", *args, **kwargs ): BaseComponent.__init__(self, parent) self._persistenceLayer = persistenceLayer self.name = name self.description = description self.status = status self._devices = DeviceManager(self) self._tasks = TaskManager(self) def __eq__(self, other): return ( self.cid == other.cid and self.name == other.name and self.description == other.description and self.status == other.status ) def __ne__(self, other): return not self.__eq__(other) def __str__(self): return "%s %s %s" % (self.name, self.description, self.status) def __getattr__(self, attr_name): if hasattr(self._devices, attr_name): return getattr(self._devices, attr_name) elif hasattr(self._tasks, attr_name): return getattr(self._tasks, attr_name) else: raise AttributeError(attr_name) """ #################################################################################### Configuration and shutdown methods """ @defer.inlineCallbacks def setup(self): """ Method configuring additional elements of the current environment """ yield self._devices.setup() yield self._tasks.setup() log.msg( "Environment ", self.name, "with id", self.cid, " setup correctly", logLevel=logging.CRITICAL, system="environment", ) def teardown(self): """