Enable more pylint rules and fix reported issues. (#30539)

* Enable pylint unreachable test.
* Enable pylint suppressed-message test.
* Enable pylint redundant-unittest-assert test.
* Enable pylint bad-open-mode test.
* Enable pylint signature-differs test.
* Enable pylint unnecessary-pass test.
* Enable pylint unnecessary-lambda test.
* Enable pylint raising-bad-type test.
* Enable pylint logging-not-lazy test.
* Enable pylint logging-format-interpolation test.
* Enable pylint useless-else-on-loop test.
This commit is contained in:
Matt Clay
2017-09-18 23:20:32 -07:00
committed by GitHub
parent 01563ccd5d
commit 7714dcd04e
36 changed files with 92 additions and 135 deletions

View File

@@ -87,6 +87,6 @@ class TestAnsibleModuleExitJson(unittest.TestCase):
for i in self.unparsable_cases:
self.assertRaises(
ValueError,
lambda data: _filter_non_json_lines(data),
_filter_non_json_lines,
data=i
)

View File

@@ -106,7 +106,7 @@ class TestManager(unittest.TestCase):
params = NONE_PARAMS.copy()
del params['vdirect_ip']
vdirect_file.VdirectFile(params)
self.assertFalse("KeyError was not thrown for missing parameter")
self.fail("KeyError was not thrown for missing parameter")
except KeyError:
assert True
@@ -134,7 +134,7 @@ class TestManager(unittest.TestCase):
file = vdirect_file.VdirectFile(NONE_PARAMS)
try:
file.upload("missing_file.vm")
self.assertFalse("IOException was not thrown for missing file")
self.fail("IOException was not thrown for missing file")
except IOError:
assert True

View File

@@ -467,7 +467,6 @@ class TestVaultEditor(unittest.TestCase):
try:
ve.decrypt_file(v11_file.name)
except errors.AnsibleError:
raise
error_hit = True
# verify decrypted content
@@ -493,7 +492,6 @@ class TestVaultEditor(unittest.TestCase):
try:
ve.rekey_file(v10_file.name, vault.match_encrypt_secret(new_secrets)[1])
except errors.AnsibleError:
raise
error_hit = True
# verify decrypted content
@@ -510,7 +508,6 @@ class TestVaultEditor(unittest.TestCase):
try:
dec_data = vl.decrypt(fdata)
except errors.AnsibleError:
raise
error_hit = True
os.unlink(v10_file.name)