public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pms-test-suite:master commit in: /
Date: Wed,  8 Jun 2011 12:44:14 +0000 (UTC)	[thread overview]
Message-ID: <9f87f959c266cb079b16094d3ab10a23137178ee.mgorny@gentoo> (raw)

commit:     9f87f959c266cb079b16094d3ab10a23137178ee
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jun  8 12:44:20 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun  8 12:44:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/pms-test-suite.git;a=commit;h=9f87f959

Run tests using 'setup.py test'.

---
 run-tests.py |   23 -----------------------
 setup.py     |   40 ++++++++++++++++++++++++++++++++++++++--
 2 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/run-tests.py b/run-tests.py
deleted file mode 100755
index 956e744..0000000
--- a/run-tests.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/python
-
-import unittest, doctest
-
-import PMSTestSuite.cli
-import PMSTestSuite.library
-import PMSTestSuite.pm
-import PMSTestSuite.pm.pkgcorepm
-import PMSTestSuite.pm.portagepm
-import PMSTestSuite.repository
-
-def load_tests(loader, tests, ignore):
-	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))
-	return tests
-
-if __name__ == '__main__':
-	unittest.main()

diff --git a/setup.py b/setup.py
index af06fec..271d13f 100755
--- a/setup.py
+++ b/setup.py
@@ -3,7 +3,7 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
-from distutils.core import setup
+from distutils.core import setup, Command
 
 import os.path, sys
 
@@ -13,6 +13,38 @@ try:
 except ImportError:
 	PV = 'unknown'
 
+class TestCommand(Command):
+	user_options = []
+
+	def initialize_options(self):
+		pass
+
+	def finalize_options(self):
+		pass
+
+	def run(self):
+		import unittest, doctest
+
+		import PMSTestSuite.cli
+		import PMSTestSuite.library
+		import PMSTestSuite.pm
+		import PMSTestSuite.pm.pkgcorepm
+		import PMSTestSuite.pm.portagepm
+		import PMSTestSuite.repository
+
+		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,
@@ -43,5 +75,9 @@ setup(
 			'Topic :: Software Development :: Quality Assurance',
 			'Topic :: Software Development :: Testing',
 			'Topic :: System :: Installation/Setup'
-		]
+		],
+
+		cmdclass = {
+			'test': TestCommand
+		}
 )



             reply	other threads:[~2011-06-08 12:44 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-08 12:44 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-04 16:49 [gentoo-commits] proj/pms-test-suite:master commit in: / Michał Górny
2012-01-02 22:03 Michał Górny
2011-08-20  6:23 Michał Górny
2011-08-14 15:04 Michał Górny
2011-08-13  8:54 Michał Górny
2011-08-08 22:15 Michał Górny
2011-07-31 14:57 Michał Górny
2011-07-31 14:43 Michał Górny
2011-07-10 10:12 Michał Górny
2011-06-29 12:58 Michał Górny
2011-06-28  7:13 Michał Górny
2011-06-28  7:13 Michał Górny
2011-06-25  8:39 Michał Górny
2011-06-25  8:39 Michał Górny
2011-06-23 21:14 Michał Górny
2011-06-23 16:28 Michał Górny
2011-06-22 11:50 Michał Górny
2011-06-22  8:18 Michał Górny
2011-06-22  8:18 Michał Górny
2011-06-19 10:54 Michał Górny
2011-06-05 18:37 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 19:18 Michał Górny
2011-05-31 18:10 Michał Górny
2011-05-31 18:10 Michał Górny
2011-05-29 17:55 Michał Górny
2011-05-27  6:21 Michał Górny
2011-05-26  7:25 Michał Górny
2011-05-25 20:40 Michał Górny
2011-05-25 18:18 Michał Górny
2011-05-24 14:28 Michał Górny
2011-05-16 20:00 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f87f959c266cb079b16094d3ab10a23137178ee.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox