aboutsummaryrefslogtreecommitdiff
blob: ad08d83a53d12ec53697b7071a708cfcff734ab5 (plain)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/python
#	vim:fileencoding=utf-8
# (c) 2011 Michał Górny <mgorny@gentoo.org>
# Released under the terms of the 2-clause BSD license.

from distutils.core import setup, Command

import os.path, subprocess, sys

sys.path.insert(0, os.path.dirname(__file__))
try:
	from pmstestsuite import PV
except ImportError:
	PV = 'unknown'

class DocCommand(Command):
	description = 'create HTML docs'
	user_options = []

	def initialize_options(self):
		pass

	def finalize_options(self):
		pass

	def run(self):
		print('Creating API docs')
		subprocess.check_call(['epydoc', '--verbose', '--html',
			'--output', 'doc', 'pmstestsuite'])

class TestCommand(Command):
	description = 'run tests'
	user_options = []

	def initialize_options(self):
		pass

	def finalize_options(self):
		pass

	def run(self):
		import unittest, doctest

		tests = unittest.TestSuite()
		tests.addTests(doctest.DocTestSuite('pmstestsuite.cli'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.library'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.library.case'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.pm'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.pm.pkgcorepm'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.pm.portagepm'))
		tests.addTests(doctest.DocTestSuite('pmstestsuite.repository'))

		r = unittest.TextTestRunner()
		res = r.run(tests)
		sys.exit(0 if res.wasSuccessful() else 1)

setup(
		name = 'pms-test-suite',
		version = PV,
		author = 'Michał Górny',
		author_email = 'mgorny@gentoo.org',
		url = 'http://www.gentoo.org/proj/en/qa/pms/pms-test-suite.xml',

		packages = [
			'pmstestsuite',
			'pmstestsuite.library',
			'pmstestsuite.library.standard',
			'pmstestsuite.library.test',
			'pmstestsuite.output',
			'pmstestsuite.pm',
			'pmstestsuite.repository'
		],
		scripts = [
			'pms-tester'
		],
		data_files = [
			('/etc/dbus-1/system.d', ['org.gentoo.pmstestsuite.conf'])
		],

		classifiers = [
			'Development Status :: 4 - Beta',
			'Environment :: Console',
			'Intended Audience :: System Administrators',
			'License :: OSI Approved :: BSD License',
			'Operating System :: POSIX',
			'Programming Language :: Python',
			'Topic :: Software Development :: Quality Assurance',
			'Topic :: Software Development :: Testing',
			'Topic :: System :: Installation/Setup'
		],

		cmdclass = {
			'doc': DocCommand,
			'test': TestCommand
		}
)