forked from alastair/python-musicbrainzngs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
53 lines (43 loc) · 1.49 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
#!/usr/bin/env python
from distutils.core import setup
from distutils.core import Command
class test(Command):
description = "run automated tests"
user_options = [
("tests=", None, "list of tests to run (default all)"),
("verbosity=", "v", "verbosity"),
]
def initialize_options(self):
self.tests = []
self.verbosity = 1
def finalize_options(self):
if self.tests:
self.tests = self.tests.split(",")
if self.verbosity:
self.verbosity = int(self.verbosity)
def run(self):
import os.path
import glob
import sys
import unittest
build = self.get_finalized_command('build')
self.run_command ('build')
sys.path.insert(0, build.build_purelib)
sys.path.insert(0, build.build_platlib)
names = []
for filename in glob.glob("test/test_*.py"):
name = os.path.splitext(os.path.basename(filename))[0]
if not self.tests or name in self.tests:
names.append("test." + name)
tests = unittest.defaultTestLoader.loadTestsFromNames(names)
t = unittest.TextTestRunner(verbosity=self.verbosity)
t.run(tests)
setup(
name="python-musicbrainz-ngs",
version="0.1",
description="python bindings for musicbrainz NGS webservice",
author="Alastair Porter",
url="https://github.com/alastair/python-musicbrainz-ngs",
py_modules=['mbxml', 'musicbrainz'],
cmdclass={'test': test },
)