diff options
author | Takashi NATSUME <natsume.takashi@lab.ntt.co.jp> | 2019-08-19 18:11:48 +0900 |
---|---|---|
committer | Eric Fried <openstack@fried.cc> | 2019-08-19 09:43:10 -0500 |
commit | 1eec451b1ba254ec4c43c77f79b0d2809d6cb9a5 (patch) | |
tree | 98ffc8abaffaedb2828b6f936428a02ca57a6963 /nova/test.py | |
parent | 8ea5e373381fc4152d2914742ef42a75acbbcc53 (diff) | |
download | nova-1eec451b1ba254ec4c43c77f79b0d2809d6cb9a5.tar.gz |
Tests: autospecs all the mock.patch usages
By default, mock.patch's autospec argument is None, meaning that
there's no signature checking for the patched methods and functions.
oslotest.mock_fixture.patch_mock_module fixes a few issues within
mock.patch functions, as well as setting autospec=True by default,
unless otherwise specified or new_callable, create, spec arguments
are passed in.
Co-Authored-By: Claudiu Belu <cbelu@cloudbasesolutions.com>
Change-Id: I4484e63c97bd1cdde3d88855eabe7545784f365e
Closes-Bug: #1735588
Diffstat (limited to 'nova/test.py')
-rw-r--r-- | nova/test.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/nova/test.py b/nova/test.py index 881718b303..4ca8872489 100644 --- a/nova/test.py +++ b/nova/test.py @@ -153,6 +153,13 @@ class skipIf(object): 'classes') +# NOTE(claudiub): this needs to be called before any mock.patch calls are +# being done, and especially before any other test classes load. This fixes +# the mock.patch autospec issue: +# https://github.com/testing-cabal/mock/issues/396 +mock_fixture.patch_mock_module() + + class NovaExceptionReraiseFormatError(object): real_log_exception = exception.NovaException._log_exception |