File: PKG-INFO

package info (click to toggle)
pytest-pep8 1.0.6-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 152 kB
  • ctags: 50
  • sloc: python: 231; makefile: 5
file content (205 lines) | stat: -rw-r--r-- 7,891 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
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@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