Fixes for tox4

- use generic test template
- remove autospec in power test as we don't use actual libvirt
module to test. The libvirt-python module is fully mocked.

Change-Id: Ied36a8afb818422c643edca8a2feeec977b53551
This commit is contained in:
Riccardo Pittau 2022-12-28 15:15:48 +01:00
parent 2976bed022
commit 6a2590ec6a
4 changed files with 13 additions and 8 deletions

View File

@ -24,7 +24,7 @@
vars:
rtd_webhook_id: '44747'
templates:
- openstack-python3-zed-jobs
- openstack-python3-jobs
- docs-on-readthedocs
- check-requirements
check:

View File

@ -167,22 +167,22 @@ class LibvirtValidateParametersTestCase(BaseLibvirtTest):
class LibvirtPrivateMethodsTestCase(BaseLibvirtTest):
@mock.patch.object(power.libvirt, 'openAuth', autospec=True)
def test__get_libvirt_connection_sasl_auth(self, libvirt_open_mock):
@mock.patch.object(power.libvirt, 'openAuth')
def test__get_libvirt_connection_sasl_auth(self, libvirt_openauth_mock):
node = obj_utils.get_test_node(
self.context,
driver='staging-libvirt',
driver_info=_get_test_libvirt_driver_info('sasl'))
power._get_libvirt_connection(node['driver_info'])
libvirt_open_mock.assert_called_once_with(
libvirt_openauth_mock.assert_called_once_with(
'test+tcp://localhost:5000/test',
[[power.libvirt.VIR_CRED_AUTHNAME,
power.libvirt.VIR_CRED_PASSPHRASE],
mock.ANY, # Inline cred function
None], 0)
@mock.patch.object(power.libvirt, 'open', autospec=True)
@mock.patch.object(power.libvirt, 'open')
def test__get_libvirt_connection_ssh(self, libvirt_open_mock):
node = obj_utils.get_test_node(
self.context,
@ -193,7 +193,7 @@ class LibvirtPrivateMethodsTestCase(BaseLibvirtTest):
libvirt_open_mock.assert_called_once_with(
'qemu+ssh://test@test/?keyfile=/test/key/file&no_verify=1')
@mock.patch.object(power.libvirt, 'open', autospec=True)
@mock.patch.object(power.libvirt, 'open')
def test__get_libvirt_connection_socket(self, libvirt_open_mock):
node = obj_utils.get_test_node(
self.context,

View File

@ -7,3 +7,4 @@ coverage!=4.4,>=4.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0
testtools>=2.2.0 # MIT
stestr>=2.0.0 # Apache-2.0

View File

@ -1,6 +1,5 @@
[tox]
minversion = 3.18.0
skipsdist = True
envlist = py3,pep8
ignore_basepython_conflict=true
@ -18,7 +17,12 @@ deps =
-r{toxinidir}/extra-requirements.txt
commands =
stestr run {posargs}
passenv = http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy NO_PROXY
passenv = http_proxy
HTTP_PROXY
https_proxy
HTTPS_PROXY
no_proxy
NO_PROXY
[testenv:pep8]
deps =