diff --git a/nova/test.py b/nova/test.py index 70ef0a11fd76..d948eb77c12c 100644 --- a/nova/test.py +++ b/nova/test.py @@ -726,11 +726,15 @@ class SubclassSignatureTestCase(testtools.TestCase, metaclass=abc.ABCMeta): # getmembers returns all members, including members inherited from # the base class. It's redundant for us to test these, but as # they'll always pass it's not worth the complexity to filter them out. - for (name, method) in inspect.getmembers(cls, inspect.ismethod): + for (name, method) in inspect.getmembers(cls, inspect.isfunction): # Subclass __init__ methods can usually be legitimately different if name == '__init__': continue + # Skip subclass private functions + if name.startswith('_'): + continue + while hasattr(method, '__wrapped__'): # This is a wrapped function. The signature we're going to # see here is that of the wrapper, which is almost certainly diff --git a/nova/tests/unit/test_test.py b/nova/tests/unit/test_test.py index 1042153b10b0..caf3f0b98874 100644 --- a/nova/tests/unit/test_test.py +++ b/nova/tests/unit/test_test.py @@ -18,6 +18,7 @@ import os.path import tempfile +import unittest from unittest import mock import uuid @@ -415,3 +416,21 @@ class PatchOpenTestCase(test.NoDBTestCase): without changing other file operations. """ self._test_patched_open() + + +class SubclassSignatureTestCaseTestCase(test.SubclassSignatureTestCase): + class Baseclass(): + def method(self): + pass + + class Subclass(Baseclass): + def method(self, different): + pass + + def _get_base_class(self): + return SubclassSignatureTestCaseTestCase.Baseclass + + @unittest.expectedFailure + def test_signatures(self): + # Test that the signature check fails when it's supposed to fail. + super().test_signatures() diff --git a/nova/virt/libvirt/volume/lightos.py b/nova/virt/libvirt/volume/lightos.py index 6a22bf6dc63c..c48890997b7f 100644 --- a/nova/virt/libvirt/volume/lightos.py +++ b/nova/virt/libvirt/volume/lightos.py @@ -52,7 +52,7 @@ class LibvirtLightOSVolumeDriver(libvirt_volume.LibvirtVolumeDriver): super(LibvirtLightOSVolumeDriver, self).disconnect_volume( connection_info, instance, force=force) - def extend_volume(self, connection_info, instance, requested_size=None): + def extend_volume(self, connection_info, instance, requested_size): """Extend the volume.""" LOG.debug("calling os-brick to extend LightOS Volume." "instance:%s, volume_id:%s",