This repository has been archived by the owner on Jun 13, 2022. It is now read-only.
/
test_code_style.py
59 lines (53 loc) · 2.75 KB
/
test_code_style.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
47
48
49
50
51
52
53
54
55
56
57
58
59
"""
@brief test log(time=0s)
"""
import os
import unittest
from pyquickhelper.loghelper import fLOG
from pyquickhelper.pycode import check_pep8, ExtTestCase
class TestCodeStyle(ExtTestCase):
"""Test style."""
def test_style_src(self):
thi = os.path.abspath(os.path.dirname(__file__))
src_ = os.path.normpath(os.path.join(thi, "..", "..", "src"))
check_pep8(src_, fLOG=fLOG,
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
'R0911', 'W0201', 'W070', 'W0622', 'R1702',
'C0111', 'W0703', 'C0200', 'C0415'),
neg_pattern='.*MokadiGrammar_((frParser)|(frListener)|(frLexer))[.]py$',
skip=["Unable to import 'ensae_teaching_cs.pythonnet'",
"treant_wrapper.py:38: W0603",
"No name 'imwrite' in module 'cv2'",
"No name 'VideoCapture' in module 'cv2'",
"pydata2016.py:77: W0612",
"mokadi_mails.py:42: W0612",
"Unable to import 'pymmails.grabber'",
"mokadi_action_slides.py:84: W0612",
"gui_mokadi_process.py:13: W0612",
"Redefining name 'fLOG' from outer scope",
"Access to member 'thread_listen' before its definition",
"Instance of 'Exception' has no 'strerror'",
"Instance of 'Exception' has no 'errno'",
"gui_mokadi.py:129",
"gui_mokadi.py:78: W0612",
"Unused variable 'ensae_teaching_cs'",
"Unable to import 'ensae_teaching_cs'",
"Unable to import 'pygame'",
"Unable to import 'pygame.camera'",
"Unable to import 'cv2'",
"Unable to import 'keyring'",
"Unable to import 'pyaudio'",
])
def test_style_test(self):
thi = os.path.abspath(os.path.dirname(__file__))
test = os.path.normpath(os.path.join(thi, "..", ))
check_pep8(test, fLOG=fLOG, neg_pattern="temp_.*",
pylint_ignore=('C0103', 'C1801', 'R0201', 'R1705', 'W0108', 'W0613',
'C0111', 'W0703', 'C0122', 'W0101', 'R1707',
'C0415', 'W0640'),
skip=["Unable to import 'ensae_teaching_cs.pythonnet'",
"Redefining name 'path' from outer scope",
"Unable to import 'keyring'",
])
if __name__ == "__main__":
unittest.main()