forked from snipsco/snips-nlu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
linting_test.py
37 lines (26 loc) · 941 Bytes
/
linting_test.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
from __future__ import unicode_literals
import os
import unittest
from pathlib import Path
from pylint.lint import Run
ROOT_PATH = Path(__file__).parent
RCFILEPATH = ROOT_PATH / "tools" / "pylintrc"
TESTED_PACKAGES = ["snips_nlu", "snips_nlu_samples", "debug"]
SKIPPED_SUB_PACKAGES = ["tests"]
class TestLinting(unittest.TestCase):
def test_linting(self):
args = ["--output-format", "parseable", "--rcfile", str(RCFILEPATH)]
args += all_python_files()
run = Run(args, exit=False)
self.assertEqual(0, run.linter.msg_status)
def all_python_files():
files = []
for p in TESTED_PACKAGES:
for dirpath, _, filenames in os.walk(str(ROOT_PATH / p)):
if Path(dirpath).name in SKIPPED_SUB_PACKAGES:
continue
files += [
os.sep.join([dirpath, f])
for f in filenames if f.endswith(".py")
]
return files