From af00973f82337a24aeececa2244ea3fc532db6d2 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Tue, 10 Apr 2012 10:58:14 +0600 Subject: Test running improvements: tests can be run under python 2.6 (by using optional unittest2), tox config for testing under different pythons, explicit python version requirements (factory_boy works with python 2.6 and 2.7); ./setup.py test returns proper error code in case of test failure. --- setup.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) mode change 100644 => 100755 setup.py (limited to 'setup.py') diff --git a/setup.py b/setup.py old mode 100644 new mode 100755 index b3ce56f..e9da2e6 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- +import sys from distutils.core import setup from distutils import cmd @@ -26,7 +27,11 @@ class test(cmd.Command): def run(self): """Run the test suite.""" - import unittest + try: + import unittest2 as unittest + except ImportError: + import unittest + if self.verbose: verbosity=1 else: @@ -34,7 +39,9 @@ class test(cmd.Command): suite = unittest.TestLoader().loadTestsFromName(self.test_suite) - unittest.TextTestRunner(verbosity=verbosity).run(suite) + result = unittest.TextTestRunner(verbosity=verbosity).run(suite) + if (not result.wasSuccessful()): + sys.exit(1) setup( @@ -45,7 +52,7 @@ setup( author_email='mark@deliciouslynerdy.com', maintainer='Raphaƫl Barrois', maintainer_email='raphael.barrois@polytechnique.org', - url='http://github.com/rbarrois/factory_boy', + url='https://github.com/rbarrois/factory_boy', keywords=['factory_boy', 'factory', 'fixtures'], packages=['factory'], license='MIT', @@ -56,6 +63,9 @@ setup( 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', 'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Libraries :: Python Modules' ], -- cgit v1.2.3