-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
74 lines (60 loc) · 1.91 KB
/
setup.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from __future__ import print_function
import os
import sys
from codecs import open
from pkg_resources import load_entry_point
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class NoseTestCommand(TestCommand):
def run_tests(self):
"""
Run nose with default arguments.
"""
import nose
from pocketlint.formatcheck import main as pocket_main
nose_args = ['nosetests']
if self.verbose:
nose_args.append('-v')
else:
nose_args.append('-q')
module = self.test_suite
if self.test_module:
module = self.test_module
nose_args.extend([
'--with-coverage',
'--cover-package=' + module,
'--cover-erase',
'--cover-test',
module.replace('.', '/'),
])
pocket_args = [
'README.rst',
'release-notes.rst',
'setup.py',
]
for root, dirs, files in os.walk('chevah/keycert', topdown=False):
for name in files:
pocket_args.append(os.path.join(root, name))
nose_code = nose.run(argv=nose_args)
if nose_code:
nose_code = 0
else:
nose_code = 1
pocket_code = pocket_main(pocket_args)
if not pocket_code:
print('Linter OK')
coverage_args = [
'report',
'--include=chevah/keycert/tests/*',
'--fail-under=100',
]
covergate_code = load_entry_point(
'coverage', 'console_scripts', 'coverage')(argv=coverage_args)
if not covergate_code:
print('Tests coverage OK')
sys.exit(pocket_code or nose_code or covergate_code)
here = os.path.abspath(os.path.dirname(__file__))
setup(
cmdclass={'test': NoseTestCommand},
test_suite='chevah_keycert',
)