autospec for classmethods and staticmethods for Python < 3.7.4
The workaround for allowing autospec for classmethods and staticmethods is also needed for Python 3.7.3, which is the version in Debian Buster. Indeed, the patch here: https://bugs.python.org/issue23078 was commited between the release of Python 3.7.3 and 3.7.4. See sha: 15a57a3cadb992bb1752302333ff593e7eab284c in the Python VCS. Change-Id: I46aedc7a318f2e77ec7e391478bc4e5baf65280e
This commit is contained in:
parent
28c0f38322
commit
a0b28708b1
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user