From d1e1de6ef8ec86f78bbcfeed6769b1d6c7fc8e8f Mon Sep 17 00:00:00 2001 From: Menno Smits Date: Tue, 19 Mar 2013 01:53:42 +0000 Subject: [PATCH] Provide custom implementation of the setup.py "test" command This uses unittest2's test discovery feature. --- setup.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 21e6752..8eac1e8 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ import distribute_setup distribute_setup.use_setuptools() from setuptools import setup, find_packages +from setuptools.command.test import test as TestCommand import imapclient version = imapclient.__version__ @@ -29,6 +30,21 @@ Features: IMAPClient includes units tests for more complex functionality and a automated functional test that can be run against a live IMAP server. """ +class TestDiscoverCommand(TestCommand): + """ + Use unittest2 to discover and run tests + """ + + def finalize_options(self): + TestCommand.finalize_options(self) + self.test_args = [] + self.test_suite = True + + def run_tests(self): + from imapclient.test.util import unittest # this will import unittest2 + unittest.main(argv=['', 'discover']) + + setup(name='IMAPClient', version=version, author="Menno Smits", @@ -51,4 +67,6 @@ setup(name='IMAPClient', 'Topic :: Communications :: Email :: Post-Office :: IMAP', 'Topic :: Internet', 'Topic :: Software Development :: Libraries :: Python Modules', - 'Topic :: System :: Networking']) + 'Topic :: System :: Networking'], + cmdclass={'test': TestDiscoverCommand}, +) -- 2.43.0