core: simplify test for methods names
The test for method names 'read_<param>' and 'write_<param>' without a defined parameter is simplified. We do not check anymore method names from base classes. Base classes inheriting from HasAccessible are checked anyway at the place they are defined. + add a test for it + move some tests to a new file test_all_modules.py, as test_modules.py is getting too long + fix missing doc string (frappy.simulation.SimDrivable.stop) Change-Id: Id8a9afe5c977ae3b1371bd40c6da52be2fc79eb9 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/35503 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@ -23,8 +23,6 @@
|
||||
|
||||
import sys
|
||||
import threading
|
||||
import importlib
|
||||
from glob import glob
|
||||
import pytest
|
||||
|
||||
from frappy.datatypes import BoolType, FloatRange, StringType, IntRange, ScaledInteger
|
||||
@ -922,27 +920,6 @@ def test_interface_classes(bases, iface_classes):
|
||||
assert m.interface_classes == iface_classes
|
||||
|
||||
|
||||
all_drivables = set()
|
||||
for pyfile in glob('frappy_*/*.py'):
|
||||
module = pyfile[:-3].replace('/', '.')
|
||||
try:
|
||||
importlib.import_module(module)
|
||||
except Exception as e:
|
||||
print(module, e)
|
||||
continue
|
||||
for obj_ in sys.modules[module].__dict__.values():
|
||||
if isinstance(obj_, type) and issubclass(obj_, Drivable):
|
||||
all_drivables.add(obj_)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('modcls', all_drivables)
|
||||
def test_stop_doc(modcls):
|
||||
# make sure that implemented stop methods have a doc string
|
||||
if (modcls.stop.description == Drivable.stop.description
|
||||
and modcls.stop.func != Drivable.stop.func):
|
||||
assert modcls.stop.func.__doc__ # stop method needs a doc string
|
||||
|
||||
|
||||
def test_write_error():
|
||||
updates = {}
|
||||
srv = ServerStub(updates)
|
||||
|
Reference in New Issue
Block a user