Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baijum/3091659 to your computer and use it in GitHub Desktop.
Save baijum/3091659 to your computer and use it in GitHub Desktop.
pylint_pytest_marker.txt
baiju@localhost ~$
$ mkdir pylint_pytest_marker
baiju@localhost ~$
$ python virtualenv.py pylintve
New python executable in pylintve/bin/python
Installing setuptools............................done.
Installing pip.....................done.
baiju@localhost ~$
$ source pylintve/bin/activate
(pylintve)
baiju@localhost ~$
$ pip install pylint
Downloading/unpacking pylint
Downloading pylint-0.25.1.tar.gz (211Kb): 211Kb downloaded
Running setup.py egg_info for package pylint
package init file './test/__init__.py' not found (or not a regular file)
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt2' under directory 'test'
warning: no files found matching 'noext'
Downloading/unpacking logilab-common>=0.53.0 (from pylint)
Downloading logilab-common-0.57.1.tar.gz (181Kb): 181Kb downloaded
Running setup.py egg_info for package logilab-common
package init file './test/__init__.py' not found (or not a regular file)
Downloading/unpacking logilab-astng>=0.21.1 (from pylint)
Downloading logilab-astng-0.23.1.tar.gz (103Kb): 103Kb downloaded
Running setup.py egg_info for package logilab-astng
package init file './test/__init__.py' not found (or not a regular file)
Downloading/unpacking unittest2>=0.5.1 (from logilab-common>=0.53.0->pylint)
Downloading unittest2-0.5.1.tar.gz (62Kb): 62Kb downloaded
Running setup.py egg_info for package unittest2
Installing collected packages: pylint, logilab-common, logilab-astng, unittest2
Running setup.py install for pylint
package init file './test/__init__.py' not found (or not a regular file)
package init file './test/__init__.py' not found (or not a regular file)
changing mode of build/scripts-2.6/pylint from 664 to 775
changing mode of build/scripts-2.6/pylint-gui from 664 to 775
changing mode of build/scripts-2.6/symilar from 664 to 775
changing mode of build/scripts-2.6/epylint from 664 to 775
changing mode of build/scripts-2.6/pyreverse from 664 to 775
SyntaxError: ('invalid syntax', ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_syntax_error.py', 1, 9, 'def toto\n'))
SyntaxError: ('unknown encoding: IBO-8859-1', ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_unknown_encoding.py', 0, 0, None))
SyntaxError: ("'continue' not properly in loop", ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_continue_not_in_loop.py', 8, None, 'continue\n'))
SyntaxError: ("'return' outside function", ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_return_outside_func.py', 3, None, 'return\n'))
SyntaxError: ('from __future__ imports must occur at the beginning of the file', ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_3k_removed_stuff_py_30.py', 4, None, 'from __future__ import generators\n'))
Sorry: IndentationError: ('expected an indented block', ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/syntax_error.py', 2, 5, "print 'hop'\n"))
SyntaxError: ("default 'except:' must be last", ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_w0705.py', 28, None, '__revision__ += 1\n'))
SyntaxError: ("'return' with argument inside generator",)
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:4: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2), "no error"
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:5: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2) #this should generate a warning
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:7: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, ), "no error"
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:8: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, )
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:9: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (1 == 1, 2 == 2, 3 == 5), "no error"
/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_assert_2uple.py:11: SyntaxWarning: assertion is always true, perhaps remove parentheses?
assert (True,'error msg') #this should generate a warning
SyntaxError: ("'yield' outside function", ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_yield_outside_func.py', 3, None, 'yield 1\n'))
SyntaxError: ('keyword argument repeated', ('/home/baiju/pylintve/lib/python2.6/site-packages/pylint/test/input/func_keyword_repeat.py', 8, None, 'function_default_arg(two=5, two=7)\n'))
package init file './test/__init__.py' not found (or not a regular file)
warning: no files found matching '*.html' under directory 'doc'
warning: no files found matching '*.txt2' under directory 'test'
warning: no files found matching 'noext'
changing mode of /home/baiju/pylintve/bin/pylint-gui to 775
changing mode of /home/baiju/pylintve/bin/pyreverse to 775
changing mode of /home/baiju/pylintve/bin/pylint to 775
changing mode of /home/baiju/pylintve/bin/epylint to 775
changing mode of /home/baiju/pylintve/bin/symilar to 775
package init file './test/__init__.py' not found (or not a regular file)
Running setup.py install for logilab-common
package init file './test/__init__.py' not found (or not a regular file)
package init file './test/__init__.py' not found (or not a regular file)
changing mode of build/scripts-2.6/pytest from 664 to 775
package init file './test/__init__.py' not found (or not a regular file)
Installing /home/baiju/pylintve/lib/python2.6/site-packages/logilab_common-0.57.1-py2.6-nspkg.pth
changing mode of /home/baiju/pylintve/bin/pytest to 775
package init file './test/__init__.py' not found (or not a regular file)
Running setup.py install for logilab-astng
package init file './test/__init__.py' not found (or not a regular file)
package init file './test/__init__.py' not found (or not a regular file)
package init file './test/__init__.py' not found (or not a regular file)
Installing /home/baiju/pylintve/lib/python2.6/site-packages/logilab_astng-0.23.1-py2.6-nspkg.pth
package init file './test/__init__.py' not found (or not a regular file)
Running setup.py install for unittest2
changing mode of build/scripts-2.6/unit2.py from 664 to 775
changing mode of build/scripts-2.6/unit2 from 664 to 775
changing mode of /home/baiju/pylintve/bin/unit2 to 775
changing mode of /home/baiju/pylintve/bin/unit2.py to 775
Installing unit2-2.6 script to /home/baiju/pylintve/bin
Installing unit2 script to /home/baiju/pylintve/bin
Successfully installed pylint logilab-common logilab-astng unittest2
Cleaning up...
(pylintve)
baiju@localhost ~$
$ pip install pytest
Downloading/unpacking pytest
Downloading pytest-2.2.4.zip (309Kb): 309Kb downloaded
Running setup.py egg_info for package pytest
Downloading/unpacking py>=1.4.8 (from pytest)
Downloading py-1.4.9.zip (224Kb): 224Kb downloaded
Running setup.py egg_info for package py
Installing collected packages: pytest, py
Running setup.py install for pytest
Installing py.test script to /home/baiju/pylintve/bin
Installing py.test-2.6 script to /home/baiju/pylintve/bin
Running setup.py install for py
Successfully installed pytest py
Cleaning up...
(pylintve)
baiju@localhost ~$
$ cd pylint_pytest_marker/
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ vim hello.py
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ cat hello.py
def say_hello():
return "Hello"
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ vim test_hello.py
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ cat test_hello.py
import pytest
class TestHello:
@pytest.mark.simple
def test_simple_hello(self):
import hello
assert hello.say_hello() == "Hello"
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ py.test -v
===================================================== test session starts =====================================================
platform linux2 -- Python 2.6.6 -- pytest-2.2.4 -- /home/baiju/pylintve/bin/python
collected 1 items
test_hello.py:6: TestHello.test_simple_hello PASSED
================================================== 1 passed in 0.01 seconds ===================================================
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ pylint test_hello.py
No config file found, using default configuration
************* Module test_hello
C: 1,0: Missing docstring
W: 4,0:TestHello: Class has no __init__ method
C: 4,0:TestHello: 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 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'
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ vim test_hello.py
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ cat test_hello.py
import pytest
@pytest.mark.simple
class TestHello:
def test_simple_hello(self):
import hello
assert hello.say_hello() == "Hello"
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ pylint test_hello.py
No config file found, using default configuration
************* Module test_hello
C: 1,0: Missing docstring
W: 4,0:TestHello: Class has no __init__ method
C: 4,0:TestHello: Missing docstring
E: 4,1:TestHello: Module 'pytest' has no 'mark' member
C: 7,4:TestHello.test_simple_hello: Missing docstring
R: 7,4:TestHello.test_simple_hello: Method could be a function
R: 4,0:TestHello: Too few public methods (1/2)
Report
======
6 statements analysed.
Statistics by type
------------------
+---------+-------+-----------+-----------+------------+---------+
|type |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module |1 |NC |NC |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|class |1 |NC |NC |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|method |1 |NC |NC |0.00 |0.00 |
+---------+-------+-----------+-----------+------------+---------+
|function |0 |NC |NC |0 |0 |
+---------+-------+-----------+-----------+------------+---------+
Duplication
-----------
+-------------------------+------+---------+-----------+
| |now |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines |0 |NC |NC |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC |NC |
+-------------------------+------+---------+-----------+
Messages by category
--------------------
+-----------+-------+---------+-----------+
|type |number |previous |difference |
+===========+=======+=========+===========+
|convention |3 |NC |NC |
+-----------+-------+---------+-----------+
|refactor |2 |NC |NC |
+-----------+-------+---------+-----------+
|warning |1 |NC |NC |
+-----------+-------+---------+-----------+
|error |1 |NC |NC |
+-----------+-------+---------+-----------+
Messages
--------
+-----------+------------+
|message id |occurrences |
+===========+============+
|C0111 |3 |
+-----------+------------+
|W0232 |1 |
+-----------+------------+
|R0903 |1 |
+-----------+------------+
|R0201 |1 |
+-----------+------------+
|E1101 |1 |
+-----------+------------+
Global evaluation
-----------------
Your code has been rated at -8.33/10
External dependencies
---------------------
::
pytest (test_hello)
Raw metrics
-----------
+----------+-------+------+---------+-----------+
|type |number |% |previous |difference |
+==========+=======+======+=========+===========+
|code |7 |87.50 |NC |NC |
+----------+-------+------+---------+-----------+
|docstring |0 |0.00 |NC |NC |
+----------+-------+------+---------+-----------+
|comment |0 |0.00 |NC |NC |
+----------+-------+------+---------+-----------+
|empty |1 |12.50 |NC |NC |
+----------+-------+------+---------+-----------+
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ vim test_hello.py
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ cat test_hello.py
import pytest
@pytest.mark.simple
def test_simple_hello():
import hello
assert hello.say_hello() == "Hello"
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ py.test -v
===================================================== test session starts =====================================================
platform linux2 -- Python 2.6.6 -- pytest-2.2.4 -- /home/baiju/pylintve/bin/python
collected 1 items
test_hello.py:4: test_simple_hello PASSED
================================================== 1 passed in 0.01 seconds ===================================================
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
$ 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'
(pylintve)
baiju@localhost ~/pylint_pytest_marker$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment