summaryrefslogtreecommitdiff
path: root/test-requirements.txt
diff options
context:
space:
mode:
authorAdam Spiers <aspiers@suse.com>2019-05-23 14:17:31 +0100
committerEric Fried <openstack@fried.cc>2019-05-25 02:49:40 +0000
commitca8f4be2a84d37319183cf9511d1791068a2e2fd (patch)
tree9a553b6537d21fe4d1a616847fd1a68c7cc80992 /test-requirements.txt
parent38222634b57a09c3ccc2526f1baf90645f1b678c (diff)
downloadnova-ca8f4be2a84d37319183cf9511d1791068a2e2fd.tar.gz
Move selective patching of open() to nova.test for reuse
Several existing tests patch open() to fake the contents of a file outside the test virtualenv, whilst avoiding interfering with reading and writing of other files inside the test virtualenv. Currently they do it by duplicating logic. Furthermore, in the near future, more tests (specifically, some SEV tests) will want to do the same selective patching, and similarly will need to avoid impacting reads of other files within the test virtualenv, e.g. placement-policy.yaml. So create new patch_open() context manager / decorator in nova.test for selectively patching open based on the path parameter, and reuse this for existing tests. Also add unit tests for all these cases. mock >= 3.0.0 is required because configparser.RawConfigParser._read() uses enumerate() to iterate over the lines of the (mocked) /etc/nova/release config file, and this uses __iter__() under the hood which was not supported via mock_open until a bug was fixed and backported to the external mock library for 3.0.0: https://bugs.python.org/issue21258 https://bugs.python.org/issue32933 https://github.com/testing-cabal/mock/commit/73f6eed0d6867299fa2543b88a07cd8f12198361 Change-Id: I19f49c923d2c41eab0c7b4cab28c50498dc07046
Diffstat (limited to 'test-requirements.txt')
-rw-r--r--test-requirements.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/test-requirements.txt b/test-requirements.txt
index 318863b7cc..60f8fb3acd 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -7,7 +7,7 @@ contextlib2>=0.5.5;python_version<'3.0' # PSF License
coverage!=4.4,>=4.0 # Apache-2.0
ddt>=1.0.1 # MIT
fixtures>=3.0.0 # Apache-2.0/BSD
-mock>=2.0.0 # BSD
+mock>=3.0.0 # BSD
mox3>=0.20.0 # Apache-2.0
psycopg2>=2.7 # LGPL/ZPL
PyMySQL>=0.7.6 # MIT License