Merge "autospec for classmethods and staticmethods for Python < 3.7.4"

This commit is contained in:
Zuul 2020-09-24 20:51:04 +00:00 committed by Gerrit Code Review
commit bd36768d24

@ -55,7 +55,7 @@ logging.setup(CONF, 'ironic')
# NOTE(rpittau) this function allows autospec for classmethods and # NOTE(rpittau) this function allows autospec for classmethods and
# staticmethods in Python 3.6, while no issue occurs in Python 3.7 # staticmethods in Python 3.6, while no issue occurs in Python 3.7.4
# and later. # and later.
# For more info please see: http://bugs.python.org/issue23078 # For more info please see: http://bugs.python.org/issue23078
def _patch_mock_callable(obj): def _patch_mock_callable(obj):
@ -133,7 +133,7 @@ class TestCase(oslo_test_base.BaseTestCase):
# subprocess.Popen is a class # subprocess.Popen is a class
self.patch(subprocess, 'Popen', DoNotCallPopen) self.patch(subprocess, 'Popen', DoNotCallPopen)
if sys.version_info < (3, 7): if sys.version_info < (3, 7, 4):
_patch_mock_callable._old_func = mock._callable _patch_mock_callable._old_func = mock._callable
mock._callable = _patch_mock_callable mock._callable = _patch_mock_callable