[TIP] Pylint error with pytest function/method lever marker - class level marker works

Baiju M baiju.m.mail at gmail.com
Wed Jul 11 10:11:46 PDT 2012


Hi,

When I use a function or method lever marker, pylint is throwing this error:

$ pylint test_hello.py
No config file found, using default configuration
************* Module test_hello
C:  1,0: Missing docstring
Traceback (most recent call last):
  File "/home/baiju/pylintve/bin/pylint", line 4, in <module>
    lint.Run(sys.argv[1:])
  File "/home/baiju/pylintve/lib/python2.6/site-packages/pylint/lint.py",
line 879, in __init__
    linter.check(args)
  File "/home/baiju/pylintve/lib/python2.6/site-packages/pylint/lint.py",
line 502, in check
    self.check_astng_module(astng, walker, rawcheckers)
  File "/home/baiju/pylintve/lib/python2.6/site-packages/pylint/lint.py",
line 574, in check_astng_module
    walker.walk(astng)
  File "/home/baiju/pylintve/lib/python2.6/site-packages/pylint/utils.py",
line 528, in walk
    self.walk(child)
  File "/home/baiju/pylintve/lib/python2.6/site-packages/pylint/utils.py",
line 525, in walk
    cb(astng)
  File
"/home/baiju/pylintve/lib/python2.6/site-packages/pylint/checkers/base.py",
line 161, in visit_function
    if not redefined_by_decorator(node):
  File
"/home/baiju/pylintve/lib/python2.6/site-packages/pylint/checkers/base.py",
line 116, in redefined_by_decorator
    decorator.expr.name == node.name):
AttributeError: 'Getattr' object has no attribute 'name'


This is the test_hello.py:

import pytest


@pytest.mark.simple
def test_simple_hello():
    import hello
    assert hello.say_hello() == "Hello"

I have kept the full traceback with all steps to reproduce this issue here:

https://gist.github.com/3091659

If I use class level markers, pylint is not throwing any error.  So, I am
not
sure whether this is a pytest issue or pylint issue.

Regards,
Baiju M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20120711/67b9a449/attachment.htm>


More information about the testing-in-python mailing list