[code-quality] Pylint failing with tox

Ahirnish Pareek ahirnish at arista.com
Thu May 12 07:00:06 EDT 2016


Hi Devs,

I am running already existing tests before adding one of my own with tox
and the test is failing along with pylint which runs after the tests.
Pylint is failing because it expects type Node and getting type Str at the
affected location.

I have changed the /pylint/tox.ini file to run only
/pylint/pylint/test/test_self.py -
commands = python -Wi -m unittest discover -s
{envsitepackagesdir}/pylint/test/ -p {posargs:**test_self**}.py

Traceback:
Traceback (most recent call last):
  File "pylint/bin/pylint", line 11, in <module>
    sys.exit(run_pylint())
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/__init__.py",
line 23, in run_pylint
    Run(sys.argv[1:])
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/lint.py",
line 1313, in __init__
    linter.check(args)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/lint.py",
line 734, in check
    self._do_check(files_or_modules)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/lint.py",
line 865, in _do_check
    self.check_astroid_module(ast_node, walker, rawcheckers, tokencheckers)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/lint.py",
line 943, in check_astroid_module
    walker.walk(ast_node)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 940, in walk
    self.walk(child)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 940, in walk
    self.walk(child)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 940, in walk
    self.walk(child)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 940, in walk
    self.walk(child)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 940, in walk
    self.walk(child)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/utils.py",
line 936, in walk
    cb(astroid)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint/checkers/base.py",
line 1951, in visit_assign
    if var_type == astroid.YES or var_type.as_string() == 'None':
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/astroid/node_classes.py",
line 446, in as_string
    return as_string.to_code(self)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/astroid/as_string.py",
line 37, in __call__
    return node.accept(self)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/astroid/node_classes.py",
line 230, in accept
    return func(self)
  File
"/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/astroid/as_string.py",
line 297, in visit_list
    return '[%s]' % ', '.join([child.accept(self) for child in node.elts])
AttributeError: 'str' object has no attribute 'accept'
ERROR: InvocationError:
'/Users/ahirnish/pylint_patch/pylint/.tox/pylint/bin/pylint -rn
--rcfile=/Users/ahirnish/pylint_patch/pylint/pylintrc
/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint'

After initial debugging, I could see that node.elts is a list of strings  =
[ '-rn', '--rcfile=/Users/ahirnish/pylint_patch/pylint/pylintrc',
'/Users/ahirnish/pylint_patch/pylint/.tox/pylint/lib/python2.7/site-packages/pylint'
]

But I cant figure out how command line arguments got introduced in the
chain. Any help here would be great.

Thanks in advance.

-- 
Regards,
Ahirnish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20160512/8f4fd989/attachment.html>


More information about the code-quality mailing list