-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_pep8.py
46 lines (34 loc) · 1.39 KB
/
test_pep8.py
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
import testsuite.utils as utils
'''
The following picky coding rules are ignored:
############# ERROR CODES ####################
E265: block comment should start with '#'
E201: whitespace after '('
E221: multiple spaces before operator
E231: missing whitespace after ',' ';' or ':'
E241: multiples spaces after ','
E722: do not use bare except, specify exception instead
E731: do not assign a lambda expression, use a def
E225 missing whitespace around operator
############# WARNINGS #######################
W291: trailing whitespace
W504: line break after binary operator
'''
def test_main():
cmd = 'python testsuite/pycodestyle.py \
--exclude=prepare_csvfiles_ref_echam.py \
--ignore=E265,W291,E201,E221,E231,E241,E722,W504 *.py'
status, _ =utils.shell_cmd(cmd)
assert status == 0, 'Violations of Pep-8-standard found!'
def test_lib():
cmd = 'python testsuite/pycodestyle.py --exclude=paths.py \
--ignore=E265,W291,E201,E221,E231,E241,E722,W504,E731 \
lib/*.py'
status, _ =utils.shell_cmd(cmd)
assert status == 0, 'Violations of Pep-8-standard found!'
def test_testsuite():
cmd = 'python testsuite/pycodestyle.py \
--ignore=E225,E265,W291,E201,E221,E231,E241,E722,W504 \
testsuite/*.py'
status, _ =utils.shell_cmd(cmd)
assert status == 0, 'Violations of Pep-8-standard found!'