Remove use of testtools.helpers.safe_hasattr

The testtools package removed safe_hasattr in version 2.5.0 [1].
Since it is only used in two unit tests, let's replace it with the
built-in hasattr.

[1] - https://github.com/testing-cabal/testtools/blob/2.5.0/NEWS#L31-L34

Change-Id: I57be2d06efe8913805069150bd3f884322a78a42
This commit is contained in:
Javier Pena 2021-08-05 09:40:19 +02:00
parent 771973a3f6
commit 6325127c03
1 changed files with 2 additions and 3 deletions

View File

@ -17,7 +17,6 @@
import logging
import testtools
from testtools import helpers
from tackerclient.tacker import v1_0 as tackerV10
@ -27,7 +26,7 @@ class TestCommandMeta(testtools.TestCase):
class FakeCommand(tackerV10.TackerCommand):
pass
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertTrue(hasattr(FakeCommand, 'log'))
self.assertIsInstance(FakeCommand.log, logging.getLoggerClass())
self.assertEqual(FakeCommand.log.name, __name__ + ".FakeCommand")
@ -35,5 +34,5 @@ class TestCommandMeta(testtools.TestCase):
class FakeCommand(tackerV10.TackerCommand):
log = None
self.assertTrue(helpers.safe_hasattr(FakeCommand, 'log'))
self.assertTrue(hasattr(FakeCommand, 'log'))
self.assertIsNone(FakeCommand.log)