[Python-modules-commits] [pytest-pep8] 01/10: New upstream version 1.0.6

Adrian Vondendriesch discostu-guest at moszumanska.debian.org
Wed May 31 15:33:20 UTC 2017


This is an automated email from the git hooks/post-receive script.

discostu-guest pushed a commit to branch master
in repository pytest-pep8.

commit f16391f29e89f9b787bbcae171dc61b1d4fef9ca
Author: Adrian Vondendriesch <adrian.vondendriesch at credativ.de>
Date:   Wed May 10 17:15:46 2017 +0200

    New upstream version 1.0.6
---
 CHANGELOG                                 |  72 +++++++++++
 LICENSE                                   |  19 +++
 MANIFEST.in                               |   8 ++
 PKG-INFO                                  | 205 ++++++++++++++++++++++++++++++
 README.txt                                | 195 ++++++++++++++++++++++++++++
 pytest_pep8.egg-info/PKG-INFO             | 205 ++++++++++++++++++++++++++++++
 pytest_pep8.egg-info/SOURCES.txt          |  14 ++
 pytest_pep8.egg-info/dependency_links.txt |   1 +
 pytest_pep8.egg-info/entry_points.txt     |   3 +
 pytest_pep8.egg-info/requires.txt         |   3 +
 pytest_pep8.egg-info/top_level.txt        |   1 +
 pytest_pep8.py                            | 123 ++++++++++++++++++
 setup.cfg                                 |   5 +
 setup.py                                  |  16 +++
 test_pep8.py                              | 143 +++++++++++++++++++++
 tox.ini                                   |  22 ++++
 16 files changed, 1035 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
new file mode 100644
index 0000000..e35791a
--- /dev/null
+++ b/CHANGELOG
@@ -0,0 +1,72 @@
+1.0.6
+----------
+
+- fix tests to accomodate newer pep version which is more sensitive
+  to detecting "E265 too many spaces"
+
+- add py34 to tox.ini
+
+- clarified in setup.py that license is MIT
+
+1.0.5
+--------------
+
+- use pytest-2.4.2 node.add_marker() API for adding "pep8" marker
+
+1.0.4
+---------------------------------
+
+- fix issue2:  make pep8 interoperate with --strict runs
+
+1.0.3
+----------------------------------------------
+
+- added pep8maxlinelength ini setting to configure the maximum allowed
+  line length.
+- add tox.ini and test_pep8.py to distribution
+
+1.0.2
+----------------------------------------------
+
+- fix a parsing bug - # is now recognized as
+  as comment and ALL will now be recognized 
+  even if other codes are specified (nonsensically)
+
+1.0.1
+----------------------------------------------
+
+- add pytest-cache dep to setup.py
+
+1.0
+----------------------------------------------
+
+- extend pep8ignore to allow lines of form
+  "glob CODE1 CODE2", for example: "test/*.py W293 E203"
+- speed up tests by preventing pep8 checking if 
+  a file was unmodified after its last change.
+- simplified pep8 checker usage (thanks flox)
+
+0.9.1
+----------------------------------------------
+
+- fixed compatibility with pep8==1.3
+- made pytest_pep8 source itself pep9 compliant
+
+0.8
+----------------------------------------------
+
+- fix a bug with ignore option when the ignore count is higher than 
+  the error count (thanks Tetsuya Morimoto)
+
+0.7
+----------------------------------------------
+
+- change defaults and ini-file option name:
+  now all pep8 checks are enabled and need to
+  be explicitely ignored through a "pep8ignore" setting
+  in the ini file.
+  
+0.6
+----------------------------------------------
+
+- initial release
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..31ecdfb
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,19 @@
+
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+     
+  The above copyright notice and this permission notice shall be included in all
+  copies or substantial portions of the Software.
+ 
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+  SOFTWARE.
+
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..ba80cc2
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,8 @@
+include CHANGELOG
+include README.txt
+include setup.py
+include tox.ini
+include LICENSE
+include test_pep8.py
+graft doc
+graft test_pep8.py
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..c1fac61
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,205 @@
+Metadata-Version: 1.0
+Name: pytest-pep8
+Version: 1.0.6
+Summary: pytest plugin to check PEP8 requirements
+Home-page: http://bitbucket.org/hpk42/pytest-pep8/
+Author: Holger Krekel and Ronny Pfannschmidt
+Author-email: holger.krekel at gmail.com
+License: MIT license
+Description: py.test plugin for efficiently checking PEP8 compliance 
+        ========================================================================
+        
+        Usage
+        ---------
+        
+        install via::
+        
+            pip install pytest-pep8
+        
+        if you then type::
+        
+            py.test --pep8
+            
+        every file ending in ``.py`` will be discovered and pep8-checked, 
+        starting from the command line arguments. 
+        
+        .. warning::
+        
+            Running pep8 tests on your project is likely to cause a lot of 
+            issues.  This plugin allows to configure on a per-project and
+            per-file basis which errors or warnings to care about, see
+            pep8ignore_.  As a preliminary advise, if you have 
+            projects where you don't want to care at all about pep8 checks, 
+            you can put configure it like this::
+        
+                # content of setup.cfg (or pytest.ini)
+                [pytest]
+                pep8ignore = * ALL
+        
+        
+        A little example 
+        -----------------------
+        
+        If you have a pep8-violating file like this::
+        
+            # content of myfile.py
+         
+            somefunc( 123,456)
+        
+        you can run it with the plugin installed::
+        
+            $ py.test --pep8
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py F
+            
+            ================================= FAILURES =================================
+            ________________________________ PEP8-check ________________________________
+            /home/hpk/tmp/doc-exec-259/myfile.py:2:10: E201 whitespace after '('
+            somefunc( 123,456)
+                     ^
+            /home/hpk/tmp/doc-exec-259/myfile.py:2:14: E231 missing whitespace after ','
+            somefunc( 123,456)
+                         ^
+            
+            ========================= 1 failed in 0.01 seconds =========================
+        
+        For the meaning of (E)rror and (W)arning codes, see the error
+        output when running against your files or checkout `pep8.py
+        <https://github.com/jcrocholl/pep8/blob/master/pep8.py>`_.
+        
+        Let's not now fix the PEP8 errors::
+        
+            # content of myfile.py
+            somefunc(123, 456)
+        
+        and run again::
+        
+            $ py.test --pep8
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py .
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        the pep8 check now is passing. Moreover, if
+        you run it once again (and report skip reasons)::
+        
+            $ py.test --pep8 -rs 
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py s
+            ========================= short test summary info ==========================
+            SKIP [1] /home/hpk/p/pytest-pep8/pytest_pep8.py:63: file(s) previously passed PEP8 checks
+            
+            ======================== 1 skipped in 0.01 seconds =========================
+        
+        you can see that the pep8 check was skipped because
+        the file has not been modified since it was last checked.
+        As the pep8 plugin uses the 
+        `pytest-cache plugin <http://pypi.python.org/pypi/pytest-cache>`_
+        to implement its caching, you can use its ``--clearcache`` option to 
+        remove all pytest caches, among them the pep8 related one, which 
+        will trigger the pep8 checking code to run once again::
+        
+            $ py.test --pep8 --clearcache
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py .
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        .. _pep8ignore:
+        
+        Configuring PEP8 options per project and file
+        ---------------------------------------------
+        
+        You may configure PEP8-checking options for your project
+        by adding an ``pep8ignore`` entry to your ``setup.cfg``
+        or ``setup.cfg`` file like this::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8ignore = E201 E231
+        
+        This would globally prevent complaints about two whitespace issues.
+        Rerunning with the above example will now look better::
+        
+            $ py.test -q  --pep8
+            collecting ... collected 1 items
+            .
+            1 passed in 0.01 seconds
+        
+        If you have some files where you want to specifically ignore 
+        some errors or warnings you can start a pep8ignore line with 
+        a glob-pattern and a space-separated list of codes::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8ignore = 
+                *.py E201
+                doc/conf.py ALL
+        
+        So if you have a conf.py like this::
+        
+            # content of doc/conf.py
+        
+            func (  [1,2,3]) #this line lots pep8 errors :)
+        
+        then running again with the previous example will show a single
+        failure and it will ignore doc/conf.py alltogether::
+        
+            $ py.test --pep8 -v # verbose shows what is ignored
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2 -- /home/hpk/venv/1/bin/python
+            pep8: performing checks
+            cachedir: /home/hpk/tmp/doc-exec-259/.cache
+            collecting ... collected 1 items
+            
+            myfile.py:0: PEP8-check(ignoring E201) PASSED
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        Note that doc/conf.py was not considered or imported.
+        
+        If you'ld like to have longer lines than 79 chars (which is the default for the
+        pep8 checker), you can configure it like this::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8maxlinelength = 99
+        
+        Running PEP8 checks and no other tests
+        ---------------------------------------------
+        
+        You can also restrict your test run to only perform "pep8" tests
+        and not any other tests by typing::
+        
+            py.test --pep8 -m pep8
+        
+        This will only run test items with the "pep8" marker which this
+        plugins adds dynamically.
+        
+        Notes
+        -------------
+        
+        The repository of this plugin is at http://bitbucket.org/hpk42/pytest-pep8
+        
+        For more info on py.test see http://pytest.org
+        
+        The code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin.
+        
+        
+Platform: UNKNOWN
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..bd00d5f
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,195 @@
+py.test plugin for efficiently checking PEP8 compliance 
+========================================================================
+
+Usage
+---------
+
+install via::
+
+    pip install pytest-pep8
+
+if you then type::
+
+    py.test --pep8
+    
+every file ending in ``.py`` will be discovered and pep8-checked, 
+starting from the command line arguments. 
+
+.. warning::
+
+    Running pep8 tests on your project is likely to cause a lot of 
+    issues.  This plugin allows to configure on a per-project and
+    per-file basis which errors or warnings to care about, see
+    pep8ignore_.  As a preliminary advise, if you have 
+    projects where you don't want to care at all about pep8 checks, 
+    you can put configure it like this::
+
+        # content of setup.cfg (or pytest.ini)
+        [pytest]
+        pep8ignore = * ALL
+
+
+A little example 
+-----------------------
+
+If you have a pep8-violating file like this::
+
+    # content of myfile.py
+ 
+    somefunc( 123,456)
+
+you can run it with the plugin installed::
+
+    $ py.test --pep8
+    =========================== test session starts ============================
+    platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+    pep8: performing checks
+    collecting ... collected 1 items
+    
+    myfile.py F
+    
+    ================================= FAILURES =================================
+    ________________________________ PEP8-check ________________________________
+    /home/hpk/tmp/doc-exec-259/myfile.py:2:10: E201 whitespace after '('
+    somefunc( 123,456)
+             ^
+    /home/hpk/tmp/doc-exec-259/myfile.py:2:14: E231 missing whitespace after ','
+    somefunc( 123,456)
+                 ^
+    
+    ========================= 1 failed in 0.01 seconds =========================
+
+For the meaning of (E)rror and (W)arning codes, see the error
+output when running against your files or checkout `pep8.py
+<https://github.com/jcrocholl/pep8/blob/master/pep8.py>`_.
+
+Let's not now fix the PEP8 errors::
+
+    # content of myfile.py
+    somefunc(123, 456)
+
+and run again::
+
+    $ py.test --pep8
+    =========================== test session starts ============================
+    platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+    pep8: performing checks
+    collecting ... collected 1 items
+    
+    myfile.py .
+    
+    ========================= 1 passed in 0.01 seconds =========================
+
+the pep8 check now is passing. Moreover, if
+you run it once again (and report skip reasons)::
+
+    $ py.test --pep8 -rs 
+    =========================== test session starts ============================
+    platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+    pep8: performing checks
+    collecting ... collected 1 items
+    
+    myfile.py s
+    ========================= short test summary info ==========================
+    SKIP [1] /home/hpk/p/pytest-pep8/pytest_pep8.py:63: file(s) previously passed PEP8 checks
+    
+    ======================== 1 skipped in 0.01 seconds =========================
+
+you can see that the pep8 check was skipped because
+the file has not been modified since it was last checked.
+As the pep8 plugin uses the 
+`pytest-cache plugin <http://pypi.python.org/pypi/pytest-cache>`_
+to implement its caching, you can use its ``--clearcache`` option to 
+remove all pytest caches, among them the pep8 related one, which 
+will trigger the pep8 checking code to run once again::
+
+    $ py.test --pep8 --clearcache
+    =========================== test session starts ============================
+    platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+    pep8: performing checks
+    collecting ... collected 1 items
+    
+    myfile.py .
+    
+    ========================= 1 passed in 0.01 seconds =========================
+
+.. _pep8ignore:
+
+Configuring PEP8 options per project and file
+---------------------------------------------
+
+You may configure PEP8-checking options for your project
+by adding an ``pep8ignore`` entry to your ``setup.cfg``
+or ``setup.cfg`` file like this::
+
+    # content of setup.cfg
+    [pytest]
+    pep8ignore = E201 E231
+
+This would globally prevent complaints about two whitespace issues.
+Rerunning with the above example will now look better::
+
+    $ py.test -q  --pep8
+    collecting ... collected 1 items
+    .
+    1 passed in 0.01 seconds
+
+If you have some files where you want to specifically ignore 
+some errors or warnings you can start a pep8ignore line with 
+a glob-pattern and a space-separated list of codes::
+
+    # content of setup.cfg
+    [pytest]
+    pep8ignore = 
+        *.py E201
+        doc/conf.py ALL
+
+So if you have a conf.py like this::
+
+    # content of doc/conf.py
+
+    func (  [1,2,3]) #this line lots pep8 errors :)
+
+then running again with the previous example will show a single
+failure and it will ignore doc/conf.py alltogether::
+
+    $ py.test --pep8 -v # verbose shows what is ignored
+    =========================== test session starts ============================
+    platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2 -- /home/hpk/venv/1/bin/python
+    pep8: performing checks
+    cachedir: /home/hpk/tmp/doc-exec-259/.cache
+    collecting ... collected 1 items
+    
+    myfile.py:0: PEP8-check(ignoring E201) PASSED
+    
+    ========================= 1 passed in 0.01 seconds =========================
+
+Note that doc/conf.py was not considered or imported.
+
+If you'ld like to have longer lines than 79 chars (which is the default for the
+pep8 checker), you can configure it like this::
+
+    # content of setup.cfg
+    [pytest]
+    pep8maxlinelength = 99
+
+Running PEP8 checks and no other tests
+---------------------------------------------
+
+You can also restrict your test run to only perform "pep8" tests
+and not any other tests by typing::
+
+    py.test --pep8 -m pep8
+
+This will only run test items with the "pep8" marker which this
+plugins adds dynamically.
+
+Notes
+-------------
+
+The repository of this plugin is at http://bitbucket.org/hpk42/pytest-pep8
+
+For more info on py.test see http://pytest.org
+
+The code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin.
+
diff --git a/pytest_pep8.egg-info/PKG-INFO b/pytest_pep8.egg-info/PKG-INFO
new file mode 100644
index 0000000..c1fac61
--- /dev/null
+++ b/pytest_pep8.egg-info/PKG-INFO
@@ -0,0 +1,205 @@
+Metadata-Version: 1.0
+Name: pytest-pep8
+Version: 1.0.6
+Summary: pytest plugin to check PEP8 requirements
+Home-page: http://bitbucket.org/hpk42/pytest-pep8/
+Author: Holger Krekel and Ronny Pfannschmidt
+Author-email: holger.krekel at gmail.com
+License: MIT license
+Description: py.test plugin for efficiently checking PEP8 compliance 
+        ========================================================================
+        
+        Usage
+        ---------
+        
+        install via::
+        
+            pip install pytest-pep8
+        
+        if you then type::
+        
+            py.test --pep8
+            
+        every file ending in ``.py`` will be discovered and pep8-checked, 
+        starting from the command line arguments. 
+        
+        .. warning::
+        
+            Running pep8 tests on your project is likely to cause a lot of 
+            issues.  This plugin allows to configure on a per-project and
+            per-file basis which errors or warnings to care about, see
+            pep8ignore_.  As a preliminary advise, if you have 
+            projects where you don't want to care at all about pep8 checks, 
+            you can put configure it like this::
+        
+                # content of setup.cfg (or pytest.ini)
+                [pytest]
+                pep8ignore = * ALL
+        
+        
+        A little example 
+        -----------------------
+        
+        If you have a pep8-violating file like this::
+        
+            # content of myfile.py
+         
+            somefunc( 123,456)
+        
+        you can run it with the plugin installed::
+        
+            $ py.test --pep8
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py F
+            
+            ================================= FAILURES =================================
+            ________________________________ PEP8-check ________________________________
+            /home/hpk/tmp/doc-exec-259/myfile.py:2:10: E201 whitespace after '('
+            somefunc( 123,456)
+                     ^
+            /home/hpk/tmp/doc-exec-259/myfile.py:2:14: E231 missing whitespace after ','
+            somefunc( 123,456)
+                         ^
+            
+            ========================= 1 failed in 0.01 seconds =========================
+        
+        For the meaning of (E)rror and (W)arning codes, see the error
+        output when running against your files or checkout `pep8.py
+        <https://github.com/jcrocholl/pep8/blob/master/pep8.py>`_.
+        
+        Let's not now fix the PEP8 errors::
+        
+            # content of myfile.py
+            somefunc(123, 456)
+        
+        and run again::
+        
+            $ py.test --pep8
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py .
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        the pep8 check now is passing. Moreover, if
+        you run it once again (and report skip reasons)::
+        
+            $ py.test --pep8 -rs 
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py s
+            ========================= short test summary info ==========================
+            SKIP [1] /home/hpk/p/pytest-pep8/pytest_pep8.py:63: file(s) previously passed PEP8 checks
+            
+            ======================== 1 skipped in 0.01 seconds =========================
+        
+        you can see that the pep8 check was skipped because
+        the file has not been modified since it was last checked.
+        As the pep8 plugin uses the 
+        `pytest-cache plugin <http://pypi.python.org/pypi/pytest-cache>`_
+        to implement its caching, you can use its ``--clearcache`` option to 
+        remove all pytest caches, among them the pep8 related one, which 
+        will trigger the pep8 checking code to run once again::
+        
+            $ py.test --pep8 --clearcache
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2
+            pep8: performing checks
+            collecting ... collected 1 items
+            
+            myfile.py .
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        .. _pep8ignore:
+        
+        Configuring PEP8 options per project and file
+        ---------------------------------------------
+        
+        You may configure PEP8-checking options for your project
+        by adding an ``pep8ignore`` entry to your ``setup.cfg``
+        or ``setup.cfg`` file like this::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8ignore = E201 E231
+        
+        This would globally prevent complaints about two whitespace issues.
+        Rerunning with the above example will now look better::
+        
+            $ py.test -q  --pep8
+            collecting ... collected 1 items
+            .
+            1 passed in 0.01 seconds
+        
+        If you have some files where you want to specifically ignore 
+        some errors or warnings you can start a pep8ignore line with 
+        a glob-pattern and a space-separated list of codes::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8ignore = 
+                *.py E201
+                doc/conf.py ALL
+        
+        So if you have a conf.py like this::
+        
+            # content of doc/conf.py
+        
+            func (  [1,2,3]) #this line lots pep8 errors :)
+        
+        then running again with the previous example will show a single
+        failure and it will ignore doc/conf.py alltogether::
+        
+            $ py.test --pep8 -v # verbose shows what is ignored
+            =========================== test session starts ============================
+            platform linux2 -- Python 2.7.3 -- pytest-2.2.5.dev2 -- /home/hpk/venv/1/bin/python
+            pep8: performing checks
+            cachedir: /home/hpk/tmp/doc-exec-259/.cache
+            collecting ... collected 1 items
+            
+            myfile.py:0: PEP8-check(ignoring E201) PASSED
+            
+            ========================= 1 passed in 0.01 seconds =========================
+        
+        Note that doc/conf.py was not considered or imported.
+        
+        If you'ld like to have longer lines than 79 chars (which is the default for the
+        pep8 checker), you can configure it like this::
+        
+            # content of setup.cfg
+            [pytest]
+            pep8maxlinelength = 99
+        
+        Running PEP8 checks and no other tests
+        ---------------------------------------------
+        
+        You can also restrict your test run to only perform "pep8" tests
+        and not any other tests by typing::
+        
+            py.test --pep8 -m pep8
+        
+        This will only run test items with the "pep8" marker which this
+        plugins adds dynamically.
+        
+        Notes
+        -------------
+        
+        The repository of this plugin is at http://bitbucket.org/hpk42/pytest-pep8
+        
+        For more info on py.test see http://pytest.org
+        
+        The code is partially based on Ronny Pfannschmidt's pytest-codecheckers plugin.
+        
+        
+Platform: UNKNOWN
diff --git a/pytest_pep8.egg-info/SOURCES.txt b/pytest_pep8.egg-info/SOURCES.txt
new file mode 100644
index 0000000..e216939
--- /dev/null
+++ b/pytest_pep8.egg-info/SOURCES.txt
@@ -0,0 +1,14 @@
+CHANGELOG
+LICENSE
+MANIFEST.in
+README.txt
+pytest_pep8.py
+setup.py
+test_pep8.py
+tox.ini
+pytest_pep8.egg-info/PKG-INFO
+pytest_pep8.egg-info/SOURCES.txt
+pytest_pep8.egg-info/dependency_links.txt
+pytest_pep8.egg-info/entry_points.txt
+pytest_pep8.egg-info/requires.txt
+pytest_pep8.egg-info/top_level.txt
\ No newline at end of file
diff --git a/pytest_pep8.egg-info/dependency_links.txt b/pytest_pep8.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/pytest_pep8.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/pytest_pep8.egg-info/entry_points.txt b/pytest_pep8.egg-info/entry_points.txt
new file mode 100644
index 0000000..5c3cb4f
--- /dev/null
+++ b/pytest_pep8.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[pytest11]
+pep8 = pytest_pep8
+
diff --git a/pytest_pep8.egg-info/requires.txt b/pytest_pep8.egg-info/requires.txt
new file mode 100644
index 0000000..a45e1c8
--- /dev/null
+++ b/pytest_pep8.egg-info/requires.txt
@@ -0,0 +1,3 @@
+pytest-cache
+pytest>=2.4.2
+pep8>=1.3
\ No newline at end of file
diff --git a/pytest_pep8.egg-info/top_level.txt b/pytest_pep8.egg-info/top_level.txt
new file mode 100644
index 0000000..09d942f
--- /dev/null
+++ b/pytest_pep8.egg-info/top_level.txt
@@ -0,0 +1 @@
+pytest_pep8
diff --git a/pytest_pep8.py b/pytest_pep8.py
new file mode 100644
index 0000000..6e6cd7e
--- /dev/null
+++ b/pytest_pep8.py
@@ -0,0 +1,123 @@
+import re
+import py
+import pytest
+import pep8
+import os
+
+__version__ = '1.0.6'
+
+HISTKEY = "pep8/mtimes"
+
+
+def pytest_addoption(parser):
+    group = parser.getgroup("general")
+    group.addoption('--pep8', action='store_true',
+        help="perform some pep8 sanity checks on .py files")
+    parser.addini("pep8ignore", type="linelist",
+        help="each line specifies a glob pattern and whitespace "
+             "separated PEP8 errors or warnings which will be ignored, "
+             "example: *.py W293")
+    parser.addini("pep8maxlinelength",
+        help="max. line length (default: %d)" % pep8.MAX_LINE_LENGTH)
+
+
+def pytest_sessionstart(session):
+    config = session.config
+    if config.option.pep8:
+        config._pep8ignore = Ignorer(config.getini("pep8ignore"))
+        config._pep8mtimes = config.cache.get(HISTKEY, {})
+        config._max_line_length = int(config.getini("pep8maxlinelength")
+                                      or pep8.MAX_LINE_LENGTH)
+
+
+def pytest_collect_file(path, parent):
+    config = parent.config
+    if config.option.pep8 and path.ext == '.py':
+        pep8ignore = config._pep8ignore(path)
+        if pep8ignore is not None:
+            return Pep8Item(path, parent, pep8ignore, config._max_line_length)
+
+
+def pytest_sessionfinish(session):
+    config = session.config
+    if hasattr(config, "_pep8mtimes"):
+        config.cache.set(HISTKEY, config._pep8mtimes)
+
+
+class Pep8Error(Exception):
+    """ indicates an error during pep8 checks. """
+
+
+class Pep8Item(pytest.Item, pytest.File):
+
+    def __init__(self, path, parent, pep8ignore, max_line_length):
+        super(Pep8Item, self).__init__(path, parent)
+        self.add_marker("pep8")
+        self.pep8ignore = pep8ignore
+        self.max_line_length = max_line_length
+
+    def setup(self):
+        pep8mtimes = self.config._pep8mtimes
+        self._pep8mtime = self.fspath.mtime()
+        old = pep8mtimes.get(str(self.fspath), (0, []))
+        if old == (self._pep8mtime, self.pep8ignore):
+            pytest.skip("file(s) previously passed PEP8 checks")
+
+    def runtest(self):
+        call = py.io.StdCapture.call
+        found_errors, out, err = call(check_file, self.fspath, self.pep8ignore,
+                                      self.max_line_length)
+        if found_errors:
+            raise Pep8Error(out, err)
+        # update mtime only if test passed
+        # otherwise failures would not be re-run next time
+        self.config._pep8mtimes[str(self.fspath)] = (self._pep8mtime,
+                                                     self.pep8ignore)
+
+    def repr_failure(self, excinfo):
+        if excinfo.errisinstance(Pep8Error):
+            return excinfo.value.args[0]
+        return super(Pep8Item, self).repr_failure(excinfo)
+
+    def reportinfo(self):
+        if self.pep8ignore:
+            ignores = "(ignoring %s)" % " ".join(self.pep8ignore)
+        else:
+            ignores = ""
+        return (self.fspath, -1, "PEP8-check%s" % ignores)
+
+
+class Ignorer:
+    def __init__(self, ignorelines, coderex=re.compile("[EW]\d\d\d")):
+        self.ignores = ignores = []
+        for line in ignorelines:
+            i = line.find("#")
+            if i != -1:
+                line = line[:i]
+            try:
+                glob, ign = line.split(None, 1)
+            except ValueError:
+                glob, ign = None, line
+            if glob and coderex.match(glob):
+                glob, ign = None, line
+            ign = ign.split()
+            if "ALL" in ign:
+                ign = None
+            if glob and "/" != os.sep and "/" in glob:
+                glob = glob.replace("/", os.sep)
+            ignores.append((glob, ign))
+
+    def __call__(self, path):
+        l = []
+        for (glob, ignlist) in self.ignores:
+            if not glob or path.fnmatch(glob):
+                if ignlist is None:
+                    return None
+                l.extend(ignlist)
+        return l
+
+
+def check_file(path, pep8ignore, max_line_length):
+    checker = pep8.Checker(str(path), ignore=pep8ignore, show_source=1,
+                           max_line_length=max_line_length)
+    return checker.check_all()
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..861a9f5
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,5 @@
+[egg_info]
+tag_build = 
+tag_date = 0
+tag_svn_revision = 0
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..19af01c
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,16 @@
+from setuptools import setup
+
+if __name__ == "__main__":
+    setup(
+        name='pytest-pep8',
+        description='pytest plugin to check PEP8 requirements',
+        long_description=open("README.txt").read(),
+        license="MIT license",
+        version='1.0.6',
+        author='Holger Krekel and Ronny Pfannschmidt',
+        author_email='holger.krekel at gmail.com',
+        url='http://bitbucket.org/hpk42/pytest-pep8/',
+        py_modules=['pytest_pep8'],
+        entry_points={'pytest11': ['pep8 = pytest_pep8']},
+        install_requires=['pytest-cache', 'pytest>=2.4.2', 'pep8>=1.3', ],
+    )
diff --git a/test_pep8.py b/test_pep8.py
new file mode 100644
index 0000000..eb8b105
--- /dev/null
+++ b/test_pep8.py
@@ -0,0 +1,143 @@
+# coding=utf8
+import pytest
+import py
+pytest_plugins = "pytester",
+
+
+def test_version():
+    import pytest_pep8
+    assert pytest_pep8.__version__
+
+
+class TestIgnores:
+    def pytest_funcarg__example(self, request):
+        testdir = request.getfuncargvalue("testdir")
... 157 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest-pep8.git



More information about the Python-modules-commits mailing list