Drop pylint due to the huge amount of false positives

Given that pylint is raising a lot of false positives
and that we have alternative static code checkers,
we decided to remove pylint from the tox envlist.

This patch also fix some pylint true positives
and cleans up the disabled pylint tests in the codebase.

Change-Id: I6fb4b9b4c80af452796032736e39ef064b9bcd03
Closes-Bug: #1297994
This commit is contained in:
Victoria Martínez de la Cruz 2014-07-11 02:19:32 -03:00
parent 3c805229ae
commit ddabc98a99
6 changed files with 7 additions and 23 deletions

View File

@ -46,10 +46,10 @@ def read_json(stream, len):
try: try:
content = strutils.safe_decode(stream.read(len), 'utf-8') content = strutils.safe_decode(stream.read(len), 'utf-8')
return json.loads(content, parse_int=_json_int) return json.loads(content, parse_int=_json_int)
except ValueError as ex:
raise MalformedJSON(ex)
except UnicodeDecodeError as ex: except UnicodeDecodeError as ex:
raise MalformedJSON(ex) raise MalformedJSON(ex)
except ValueError as ex:
raise MalformedJSON(ex)
def to_json(obj): def to_json(obj):

View File

@ -70,7 +70,6 @@ class FunctionalTestBase(testing.TestBase):
# NOTE(flaper87): Use running instances. # NOTE(flaper87): Use running instances.
if self.cfg.marconi.run_server: if self.cfg.marconi.run_server:
if not (self.server and self.server.is_alive()): if not (self.server and self.server.is_alive()):
# pylint: disable=not-callable
self.server = self.server_class() self.server = self.server_class()
self.server.start(self.mconf) self.server.start(self.mconf)

View File

@ -52,7 +52,6 @@ class ControllerBaseTest(testing.TestBase):
oslo_cache.register_oslo_configs(self.conf) oslo_cache.register_oslo_configs(self.conf)
cache = oslo_cache.get_cache(self.conf.cache_url) cache = oslo_cache.get_cache(self.conf.cache_url)
# pylint: disable=not-callable
self.conf.register_opts(bootstrap._GENERAL_OPTIONS) self.conf.register_opts(bootstrap._GENERAL_OPTIONS)
pooling = 'pooling' in self.conf and self.conf.pooling pooling = 'pooling' in self.conf and self.conf.pooling
if pooling and not self.control_driver_class: if pooling and not self.control_driver_class:
@ -60,10 +59,8 @@ class ControllerBaseTest(testing.TestBase):
"but control driver class is not specified") "but control driver class is not specified")
if not pooling: if not pooling:
# pylint: disable=not-callable
self.driver = self.driver_class(self.conf, cache) self.driver = self.driver_class(self.conf, cache)
else: else:
# pylint: disable=not-callable
control = self.control_driver_class(self.conf, cache) control = self.control_driver_class(self.conf, cache)
uri = "sqlite:///:memory:" uri = "sqlite:///:memory:"
for i in range(4): for i in range(4):
@ -75,10 +72,8 @@ class ControllerBaseTest(testing.TestBase):
self.addCleanup(self._purge_databases) self.addCleanup(self._purge_databases)
if not pooling: if not pooling:
# pylint: disable=not-callable
self.controller = self.controller_class(self.driver) self.controller = self.controller_class(self.driver)
else: else:
# pylint: disable=not-callable
self.controller = self.controller_class(self.driver._pool_catalog) self.controller = self.controller_class(self.driver._pool_catalog)
def _prepare_conf(self): def _prepare_conf(self):

View File

@ -263,12 +263,12 @@ class TestMessages(base.V1FunctionalTestBase):
test_message_bulk_insert_large_bodies.tags = ['positive'] test_message_bulk_insert_large_bodies.tags = ['positive']
@ddt.data(1, 10) @ddt.data(1, 10)
def test_message_bulk_insert_large_bodies(self, offset): def test_message_bulk_insert_large_bodies_(self, offset):
"""Insert just under than max allowed messages.""" """Insert just under than max allowed messages."""
result = self._post_large_bulk_insert(offset) result = self._post_large_bulk_insert(offset)
self.assertEqual(result.status_code, 400) self.assertEqual(result.status_code, 400)
test_message_bulk_insert_large_bodies.tags = ['negative'] test_message_bulk_insert_large_bodies_.tags = ['negative']
def test_message_bulk_insert_oversized(self): def test_message_bulk_insert_oversized(self):
"""Insert more than max allowed size.""" """Insert more than max allowed size."""

View File

@ -326,12 +326,12 @@ class TestMessages(base.V1_1FunctionalTestBase):
test_message_bulk_insert_large_bodies.tags = ['positive'] test_message_bulk_insert_large_bodies.tags = ['positive']
@ddt.data(1, 10) @ddt.data(1, 10)
def test_message_bulk_insert_large_bodies(self, offset): def test_message_bulk_insert_large_bodies_(self, offset):
"""Insert just under than max allowed messages.""" """Insert just under than max allowed messages."""
result = self._post_large_bulk_insert(offset) result = self._post_large_bulk_insert(offset)
self.assertEqual(result.status_code, 400) self.assertEqual(result.status_code, 400)
test_message_bulk_insert_large_bodies.tags = ['negative'] test_message_bulk_insert_large_bodies_.tags = ['negative']
def test_message_bulk_insert_oversized(self): def test_message_bulk_insert_oversized(self):
"""Insert more than max allowed size.""" """Insert more than max allowed size."""

12
tox.ini
View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = py26,py27,py33,pypy,pep8,lint2,lint3 envlist = py26,py27,py33,pypy,pep8
skipsdist = True skipsdist = True
[testenv] [testenv]
@ -26,16 +26,6 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
commands = flake8 commands = flake8
[testenv:lint2]
basepython = python2
deps = pylint
commands = pylint ./marconi ./tests -E --ignore ./openstack
[testenv:lint3]
basepython = python3
deps = pylint
commands = pylint ./marconi ./tests -E --ignore ./openstack
[testenv:cover] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1
commands = commands =