[Pkg-mpd-commits] [python-mpd] 182/262: integrate tox into setup.py

Simon McVittie smcv at debian.org
Sun May 22 18:16:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch upstream
in repository python-mpd.

commit 10f0d9f791282c3ba7772ff1d85bbc2e5a08c746
Author: Jörg Thalheim <joerg at higgsboson.tk>
Date:   Mon Jan 14 20:31:58 2013 +0100

    integrate tox into setup.py
---
 README.rst | 11 +++++------
 setup.py   | 19 ++++++++++++++++---
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/README.rst b/README.rst
index 803c556..f72b304 100644
--- a/README.rst
+++ b/README.rst
@@ -238,13 +238,12 @@ Take a look at ``examples/locking.py`` for further informations.
 Testing
 -------
 
-You can test the project using `Tox <http://tox.testrun.org/>`_, this
-will take care of testing against all the supported Python versions (at
-least available) on our computer, with the required dependencies::
+Just run::
 
-    $ pip install tox
-    $ cd /path/to/python-mpd2
-    $ tox
+    $ python setup.py test
+
+This will install `Tox <http://tox.testrun.org/>`_.
+Tox will take care of testing against all the supported Python versions (at least available) on our computer, with the required dependencies
 
 Contacting the author
 ---------------------
diff --git a/setup.py b/setup.py
index e42efd8..bfd6360 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,9 @@
 
 from distutils.core import setup
 from setuptools import Extension
-
+from setuptools.command.test import test as TestCommand
+import sys
+import mpd
 
 DESCRIPTION = """\
 An MPD (Music Player Daemon) client library written in pure Python.\
@@ -35,6 +37,17 @@ GNU Lesser General Public License for more details.  You should have received a
 along with python-mpd2.  If not, see <http://www.gnu.org/licenses/>.\
 """
 
+class Tox(TestCommand):
+    def finalize_options(self):
+        TestCommand.finalize_options(self)
+        self.test_args = []
+        self.test_suite = True
+    def run_tests(self):
+        #import here, cause outside the eggs aren't loaded
+        import tox
+        errno = tox.cmdline(self.test_args)
+        sys.exit(errno)
+
 setup(
     name="python-mpd2",
     version="0.5.0",
@@ -48,8 +61,8 @@ setup(
     classifiers=CLASSIFIERS,
     #license=LICENSE,
     keywords=["mpd"],
-    #platforms=["Independant"],
-    test_suite="test"
+    tests_require=['tox'],
+    cmdclass = {'test': Tox},
 )
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mpd/python-mpd.git



More information about the Pkg-mpd-commits mailing list