<br><br><div class="gmail_quote">On Mon, Dec 6, 2010 at 8:46 AM, holger krekel <span dir="ltr"><<a href="mailto:holger@merlinux.eu">holger@merlinux.eu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
just released an initial version 0.6 of the pytest-pep8 plugin,<br>
integrating the ``pep8`` module into py.test runs, allowing full<br>
per-project customization and configuration.<br>
<br></blockquote><div><br></div><div>This looks very useful as py.test plugin. </div><div><br></div><div>Is there any way of getting junit output from it? This would help when using it with Hudson.</div><div><br></div><div>
We already use the junit flag to output test results but wanted to add something like the pep8 plugin</div><div>for correctness :)</div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
See <a href="http://pypi.python.org/pypi/pytest-pep8" target="_blank">http://pypi.python.org/pypi/pytest-pep8</a> for installation<br>
and configuration instructions.<br>
<br>
best,<br>
holger<br>
<br>
Usage<br>
-----------------<br>
<br>
install pytest-pep8 via::<br>
<br>
easy_install pytest-pep8 # or<br>
pip install pytest-pep8<br>
<br>
and then type::<br>
<br>
py.test --pep8<br>
<br>
to activate source code checking. Every file ending in ``.py`` will be<br>
discovered and checked, starting from the command line arguments.<br>
For example, if you have a file like this::<br>
<br>
# content of myfile.py<br>
<br>
somefunc( 123,456)<br>
<br>
you can run it with::<br>
<br>
$ py.test --pep8<br>
=========================== test session starts ============================<br>
platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev1<br>
pep8 ignore opts: E202 E221 E222 E241 E301 E302 E401 E501 E701 W293 W391 W601 W602<br>
collecting ... collected 1 items<br>
<br>
myfile.py F<br>
<br>
================================= FAILURES =================================<br>
________________________________ PEP8-check ________________________________<br>
/tmp/doc-exec-12/myfile.py:2:10: E201 whitespace after '('<br>
somefunc( 123,456)<br>
^<br>
/tmp/doc-exec-12/myfile.py:2:14: E231 missing whitespace after ','<br>
somefunc( 123,456)<br>
^<br>
<br>
========================= 1 failed in 0.01 seconds =========================<br>
<br>
Note that in the testing header you see the current list of default "ignores".<br>
For the meaning of these error and warning codes, see the error output<br>
when running against your files or checkout `pep8.py<br>
<<a href="https://github.com/jcrocholl/pep8/blob/master/pep8.py" target="_blank">https://github.com/jcrocholl/pep8/blob/master/pep8.py</a>>`_.<br>
<br>
Configuring PEP8 options per-project<br>
---------------------------------------------<br>
<br>
Lastly, you may configure PEP8-checking options for your project<br>
by adding an ``pep8options`` entry to your ``pytest.ini``<br>
or ``setup.cfg`` file like this::<br>
<br>
[pytest]<br>
pep8options = +W293 -E200<br>
<br>
<br>
Running PEP8 checks and no other tests<br>
---------------------------------------------<br>
<br>
You can also restrict your test run to only perform "pep8" tests<br>
and not any other tests by typing::<br>
<br>
py.test --pep8 -k pep8<br>
<br>
This will only run tests that are marked with the "pep8" keyword<br>
which is added for the pep8 test items added by this plugin.<br>
<br>
Notes<br>
-------------<br>
<br>
The repository of this plugin is at <a href="http://bitbucket.org/hpk42/pytest-pep8" target="_blank">http://bitbucket.org/hpk42/pytest-pep8</a><br>
<br>
For more info on py.test see <a href="http://pytest.org" target="_blank">http://pytest.org</a><br>
<br>
The code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin.<br>
<br>
<br>
_______________________________________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
</blockquote></div><br>