diff options
author | Balazs Gibizer <gibi@redhat.com> | 2022-08-08 19:44:41 +0200 |
---|---|---|
committer | Sean Mooney <work@seanmooney.info> | 2022-12-01 18:14:01 +0000 |
commit | b36bc9247ff195d983865860aef8e90bf49334e9 (patch) | |
tree | bdd1c38eafefd378f35c02b71feb4b978a5ff5a1 /nova/tests/functional/test_servers.py | |
parent | 54c7c97cb83609cbcba44856d412dae11fe8643b (diff) | |
download | nova-b36bc9247ff195d983865860aef8e90bf49334e9.tar.gz |
Remove double mocking... again
I thought we fixed all the double mocking issues with
I3998d0d49583806ac1c3ae64f1b1fe343cefd20d but I was wrong.
While we used both mock and unittest.mock the fixtures.MockPatch
used the mock lib instead of the unittest.mock lib.
The path Ibf4f36136f2c65adad64f75d665c00cf2de4b400 (Remove the PowerVM driver)
removed the last user of mock lib from nova. So it is also
removed the mock from test-requirements. This triggered that
fixtures.MockPatch athat started using unittest.mock too.
Before Ibf4f36136f2c65adad64f75d665c00cf2de4b400 a function can be mocked
twice once with unittest.mock and once with fixtures.MockPatch (still
using mock). However after that patch both path of such double
mocking goes through unittest.mock and the second one fails.
So this patch fixes double mocking so far hidden behind
fixtures.MockPatch.
This patch made the py310 and functional-py310 jobs voting on master
however that has been dropped as part of the backport.
Conflicts:
nova/tests/fixtures/nova.py
nova/tests/unit/api/openstack/compute/test_quotas.py
nova/tests/unit/api/openstack/compute/test_server_group_quotas.py
Conflicts are due to lack of unified limits feature in xena
Change-Id: Ic1352ec31996577a5d0ad18a057339df3e49de25
(cherry picked from commit bf654e3a4a8f690ad0bec0955690bf4fadf98dba)
(cherry picked from commit 69667a817cb65c3efbe4e3ada0e8c69c0a106087)
Diffstat (limited to 'nova/tests/functional/test_servers.py')
-rw-r--r-- | nova/tests/functional/test_servers.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index 117bbe8a41..9f4d8bb893 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -1253,9 +1253,7 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase): def test_get_servers_detail_filters(self): # We get the results only from the up cells, this ignoring the down # cells if list_records_by_skipping_down_cells config option is True. - api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( - api_version='v2.1')) - self.admin_api = api_fixture.admin_api + self.admin_api = self.api_fixture.admin_api self.admin_api.microversion = '2.69' servers = self.admin_api.get_servers( search_opts={'hostname': "cell3-inst0"}) @@ -1263,9 +1261,7 @@ class ServerTestV269(integrated_helpers._IntegratedTestBase): self.assertEqual(self.up_cell_insts[2], servers[0]['id']) def test_get_servers_detail_all_tenants_with_down_cells(self): - api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( - api_version='v2.1')) - self.admin_api = api_fixture.admin_api + self.admin_api = self.api_fixture.admin_api self.admin_api.microversion = '2.69' servers = self.admin_api.get_servers(search_opts={'all_tenants': True}) # 4 servers from the up cells and 4 servers from the down cells @@ -1523,10 +1519,8 @@ class ServersTestV280(integrated_helpers._IntegratedTestBase): def setUp(self): super(ServersTestV280, self).setUp() - api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( - api_version='v2.1')) - self.api = api_fixture.api - self.admin_api = api_fixture.admin_api + self.api = self.api_fixture.api + self.admin_api = self.api_fixture.admin_api self.api.microversion = '2.80' self.admin_api.microversion = '2.80' @@ -1585,9 +1579,8 @@ class ServersTestV280(integrated_helpers._IntegratedTestBase): project_id_1 = '4906260553374bf0a5d566543b320516' project_id_2 = 'c850298c1b6b4796a8f197ac310b2469' - new_api_fixture = self.useFixture(nova_fixtures.OSAPIFixture( - api_version=self.api_major_version, project_id=project_id_1)) - new_admin_api = new_api_fixture.admin_api + new_admin_api = self.api_fixture.alternative_admin_api + new_admin_api.project_id = project_id_1 new_admin_api.microversion = '2.80' post = { |