tests: change safe_hasattr to hasattr

testtools 2.5.0 removed the helper (see [0]) safe_hasattr, and assumes
that the hasattr implementation in python reliable enough now.

test_neutron_dhcp_agent_list_hosting_net is skipped temporarily
as there is no DHCP agent with ML2/OVN. It will be re-enabled [1].

[0] https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31
[1] https://review.opendev.org/c/openstack/python-neutronclient/+/801997

Change-Id: I4fe6fabc4f745e2c9a366e30dbea7e7200151f12
This commit is contained in:
elajkat
2021-07-26 14:54:15 +02:00
committed by Akihiro Motoki
parent adf21f0288
commit 23fb666f92
2 changed files with 4 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
import re
from tempest.lib import exceptions
import testtools
from neutronclient.tests.functional import base
@@ -51,6 +52,7 @@ class SimpleReadOnlyNeutronClientTest(base.ClientTestBase):
ext = self.parser.listing(self.neutron('ext-list'))
self.assertTableStruct(ext, ['alias', 'name'])
@testtools.skip('Skipped until ML2/OVS is enabled')
def test_neutron_dhcp_agent_list_hosting_net(self):
self.neutron('dhcp-agent-list-hosting-net',
params='private')

View File

@@ -20,7 +20,6 @@
import logging
import testtools
from testtools import helpers
from neutronclient.neutron import v2_0 as neutronV20
@@ -30,7 +29,7 @@ class TestCommandMeta(testtools.TestCase):
class FakeCommand(neutronV20.NeutronCommand):
pass
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertTrue(hasattr(FakeCommand, 'log'))
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass())
self.assertEqual(__name__ + ".FakeCommand", FakeCommand.log.name)
@@ -38,5 +37,5 @@ class TestCommandMeta(testtools.TestCase):
class FakeCommand(neutronV20.NeutronCommand):
log = None
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertTrue(hasattr(FakeCommand, 'log'))
self.assertIsNone(FakeCommand.log)