summaryrefslogtreecommitdiff
path: root/nova/tests/unit/test_versions.py
Commit message (Collapse)AuthorAgeFilesLines
* Change API unexpected exception messageBelmiro Moreira2021-02-171-1/+3
| | | | | | | | | | | | The "API unexpected exception" message can now be configured by the cloud provider. By default it continues to display the "launchpad" webpage to report the nova bug, but it can be configured by the cloud provider to point to a custom support page. Change-Id: Ib262b91b57f832cbcc233f24f15572e1ea6803bd Closes-Bug: #1810342
* Move selective patching of open() to nova.test for reuseAdam Spiers2019-05-251-14/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Use stub_out and mock to remove mox: part 2jichenjc2015-12-191-4/+4
| | | | | | | | | | | | | | This change replaces the use of stubs in a few files with stub_out, which was introduced in test.py. Also, remove mox usage in some of the files. unit/test_wsgi.py unit/test_versions.py unit/test_utils.py Part of bp:remove-mox Change-Id: I0ba80882e745fdf6a208db2455df0a1b458ce836
* Fix version unit test on Python 3Victor Stinner2015-05-251-6/+5
| | | | | | | | | | | | | | | | | | | | | With this change, "tox -e py34" now pass. Changes: * Replace unichr() with six.unichr() * Replace StringIO.StringIO() with six.Bytes() in nova.crypto.generate_key_pair() * On Python 3, replace UserDict.IterableUserDict with collections.UserDict * Replace __builtin__.open with six.moves.builtins.open * Replace ConfigParser import with six.moves.configparser * On Python 3, get the original "queue" module instead of the "Queue" module in nova/virt/libvirt/host.py * Replace urllib2 with six.moves.urllib * tox.ini: "tox -e py34" now only runs nova.tests.unit.test_versions Blueprint nova-python3 Change-Id: I056769c7c5b32276894f7aade8c0a27af81c42ae
* Make test_version_string_with_package_is_good work with pbr 0.11Joe Gordon2015-04-301-1/+2
| | | | | | | | nova.version uses the version_string() API not version. Fix the test to reflect that and make it work with pbr 0.11 Closes-Bug: #1450682 Change-Id: I4887b8000c9943c91f8add56fcc54fa18e78d683
* Switch to using oslo_* instead of oslo.*Davanum Srinivas2015-02-061-1/+1
| | | | | | | | | | | | | | | | | | | The oslo team is recommending everyone to switch to the non-namespaced versions of libraries. Updating the hacking rule to include a check to prevent oslo.* import from creeping back in. This commit includes: - using oslo_utils instead of oslo.utils - using oslo_serialization instead of oslo.serialization - using oslo_db instead of oslo.db - using oslo_i18n instead of oslo.i18n - using oslo_middleware instead of oslo.middleware - using oslo_config instead of oslo.config - using oslo_messaging instead of "from oslo import messaging" - using oslo_vmware instead of oslo.vmware Change-Id: I3e2eb147b321ce3e928817b62abcb7d023c5f13f
* move all tests to nova/tests/unitSean Dague2014-11-121-0/+60
As part of the split of functional and unit tests we need to isolate the unit tests into a separate directory for having multiple test targets in a sane way. Part of bp:functional-tests-for-nova Change-Id: Id42ba373c1bda6a312b673ab2b489ca56da8c628