forked from babca/python-gsmmodem
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
executable file
·52 lines (37 loc) · 1.18 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
#!/usr/bin/env python
""" python-gsmmodem installation script """
import sys
from distutils.core import Command
from setuptools import setup
test_command = [sys.executable, '-m', 'unittest', 'discover']
coverage_command = ['coverage', 'run', '-m', 'unittest', 'discover']
VERSION = "0.12"
class RunUnitTests(Command):
""" run unit tests """
user_options = []
description = __doc__[1:]
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import subprocess
errno = subprocess.call(test_command)
raise SystemExit(errno)
class RunUnitTestsCoverage(Command):
""" run unit tests and report on code coverage using the 'coverage' tool """
user_options = []
description = __doc__[1:]
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import subprocess
errno = subprocess.call(coverage_command)
if errno == 0:
subprocess.call(['coverage', 'report'])
raise SystemExit(errno)
setup(use_scm_version=True,
cmdclass = {'test': RunUnitTests,
'coverage': RunUnitTestsCoverage})