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:
@@ -13,6 +13,7 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
from tempest.lib import exceptions
|
from tempest.lib import exceptions
|
||||||
|
import testtools
|
||||||
|
|
||||||
from neutronclient.tests.functional import base
|
from neutronclient.tests.functional import base
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ class SimpleReadOnlyNeutronClientTest(base.ClientTestBase):
|
|||||||
ext = self.parser.listing(self.neutron('ext-list'))
|
ext = self.parser.listing(self.neutron('ext-list'))
|
||||||
self.assertTableStruct(ext, ['alias', 'name'])
|
self.assertTableStruct(ext, ['alias', 'name'])
|
||||||
|
|
||||||
|
@testtools.skip('Skipped until ML2/OVS is enabled')
|
||||||
def test_neutron_dhcp_agent_list_hosting_net(self):
|
def test_neutron_dhcp_agent_list_hosting_net(self):
|
||||||
self.neutron('dhcp-agent-list-hosting-net',
|
self.neutron('dhcp-agent-list-hosting-net',
|
||||||
params='private')
|
params='private')
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import testtools
|
import testtools
|
||||||
from testtools import helpers
|
|
||||||
|
|
||||||
from neutronclient.neutron import v2_0 as neutronV20
|
from neutronclient.neutron import v2_0 as neutronV20
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ class TestCommandMeta(testtools.TestCase):
|
|||||||
class FakeCommand(neutronV20.NeutronCommand):
|
class FakeCommand(neutronV20.NeutronCommand):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
|
self.assertTrue(hasattr(FakeCommand, 'log'))
|
||||||
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass())
|
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass())
|
||||||
self.assertEqual(__name__ + ".FakeCommand", FakeCommand.log.name)
|
self.assertEqual(__name__ + ".FakeCommand", FakeCommand.log.name)
|
||||||
|
|
||||||
@@ -38,5 +37,5 @@ class TestCommandMeta(testtools.TestCase):
|
|||||||
class FakeCommand(neutronV20.NeutronCommand):
|
class FakeCommand(neutronV20.NeutronCommand):
|
||||||
log = None
|
log = None
|
||||||
|
|
||||||
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
|
self.assertTrue(hasattr(FakeCommand, 'log'))
|
||||||
self.assertIsNone(FakeCommand.log)
|
self.assertIsNone(FakeCommand.log)
|
||||||
|
Reference in New Issue
Block a user