Fix interface class list
Communicator Modules were exported with the interface class Module instead of the correct Communicator interface. Modules that combine Drivable etc. and Communicator also did not have Communicator listed as a second valid interface class. Change-Id: Ib74d866cf97631f7fbc29ea9914b2968010cf226 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/31037 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de>
This commit is contained in:
@ -376,7 +376,7 @@ class Module(HasAccessibles):
|
|||||||
# b.__name__ for b in mycls.__mro__ if b.__module__.startswith('frappy.modules')]
|
# b.__name__ for b in mycls.__mro__ if b.__module__.startswith('frappy.modules')]
|
||||||
# list of only the 'highest' secop module class
|
# list of only the 'highest' secop module class
|
||||||
self.interface_classes = [
|
self.interface_classes = [
|
||||||
b.__name__ for b in mycls.__mro__ if issubclass(Drivable, b)][0:1]
|
b.__name__ for b in mycls.__mro__ if b in SECoP_BASE_CLASSES][:1]
|
||||||
|
|
||||||
# handle Features
|
# handle Features
|
||||||
self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__]
|
self.features = [b.__name__ for b in mycls.__mro__ if Feature in b.__bases__]
|
||||||
@ -897,6 +897,7 @@ class Communicator(HasComlog, Module):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
|
SECoP_BASE_CLASSES = {Readable, Writable, Drivable, Communicator}
|
||||||
|
|
||||||
class Attached(Property):
|
class Attached(Property):
|
||||||
"""a special property, defining an attached module
|
"""a special property, defining an attached module
|
||||||
|
@ -28,7 +28,7 @@ import pytest
|
|||||||
|
|
||||||
from frappy.datatypes import BoolType, FloatRange, StringType, IntRange, ScaledInteger
|
from frappy.datatypes import BoolType, FloatRange, StringType, IntRange, ScaledInteger
|
||||||
from frappy.errors import ProgrammingError, ConfigError, RangeError
|
from frappy.errors import ProgrammingError, ConfigError, RangeError
|
||||||
from frappy.modules import Communicator, Drivable, Readable, Module
|
from frappy.modules import Communicator, Drivable, Readable, Module, Writable
|
||||||
from frappy.params import Command, Parameter, Limit
|
from frappy.params import Command, Parameter, Limit
|
||||||
from frappy.rwhandler import ReadHandler, WriteHandler, nopoll
|
from frappy.rwhandler import ReadHandler, WriteHandler, nopoll
|
||||||
from frappy.lib import generalConfig
|
from frappy.lib import generalConfig
|
||||||
@ -902,3 +902,17 @@ def test_limit_inheritance():
|
|||||||
|
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
mod2.write_a(0)
|
mod2.write_a(0)
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('bases, iface_classes', [
|
||||||
|
([Module], ()),
|
||||||
|
([Communicator], ('Communicator',)),
|
||||||
|
([Readable], ('Readable',)),
|
||||||
|
([Writable], ('Writable',)),
|
||||||
|
([Drivable], ('Drivable',)),
|
||||||
|
])
|
||||||
|
def test_interface_classes(bases, iface_classes):
|
||||||
|
srv = ServerStub({})
|
||||||
|
class Mod(*bases):
|
||||||
|
pass
|
||||||
|
m = Mod('mod', LoggerStub(), {'description': 'test'}, srv)
|
||||||
|
assert m.interface_classes == iface_classes
|
||||||
|
Reference in New Issue
Block a user