Enable hacking extensions framework

<long rant deleted>

This change enables the hacking extensions ability in trove. That
includes bumping the version of hacking that we use, and also adding
the enable-extensions like in the [flake8] section. I've enabled two
of the hacking extensions here.

There are some limitations to the hacking rules that I've enabled so
I'm also going to enter two bugs that others can fix (if they so
desire).

Change-Id: I6d8fc4bc03f948b84ad823e5248d78a4caa5c042
Related-Bug: 1642554
Related-Bug: 1642552
This commit is contained in:
Amrith Kumar 2016-11-17 06:11:39 -05:00
parent 0d514081c9
commit 0a9b1e45fc
4 changed files with 6 additions and 5 deletions

View File

@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
# Hacking already pins down pep8, pyflakes and flake8
hacking<0.11,>=0.10.0
hacking<0.13,>=0.12.0 # Apache-2.0
bandit>=1.1.0 # Apache-2.0
sphinx!=1.3b1,<1.4,>=1.2.1 # BSD
os-api-ref>=1.0.0 # Apache-2.0

View File

@ -72,6 +72,7 @@ show-source = True
# H301 is ignored on purpose.
# The rest of the ignores are TODOs.
ignore = F821,H301,H404,H405,H501
enable-extensions = H203,H106
builtins = _
exclude=.venv,.tox,.git,dist,doc,*egg,tools,etc,build,*.po,*.pot,integration
filename=*.py,trove-*

View File

@ -135,7 +135,7 @@ class DatastoreUserTest(trove_testtools.TestCase):
def _test_user_basic(self, user):
self.assertEqual(self.username, user.name)
self.assertEqual(None, user.password)
self.assertIsNone(user.password)
self.assertEqual(self.host_wildcard, user.host)
self.assertEqual([], user.databases)
@ -316,7 +316,7 @@ class DatastoreUserTest(trove_testtools.TestCase):
def test_validate_dict_defaults(self):
user = models.DatastoreUser(self.username)
user.verify_dict()
self.assertEqual(None, user.password)
self.assertIsNone(user.password)
self.assertEqual(self.host_wildcard, user.host)
self.assertEqual([], user.databases)

View File

@ -164,8 +164,8 @@ class SecurityGroupDeleteTest(trove_testtools.TestCase):
sec_mod.SecurityGroupInstanceAssociation.find_by = Mock(
return_value=fake_SecGr_Association())
sec_mod.SecurityGroupInstanceAssociation.delete = self.fException
self.assertNotEqual(sec_mod.SecurityGroupInstanceAssociation.find_by(
i_id, deleted=False).get_security_group(), None)
self.assertIsNotNone(sec_mod.SecurityGroupInstanceAssociation.find_by(
i_id, deleted=False).get_security_group())
self.assertTrue(hasattr(sec_mod.SecurityGroupInstanceAssociation.
find_by(i_id, deleted=False).
get_security_group(), 'delete'))