diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-10 00:01:43 -0700 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2012-04-10 00:01:43 -0700 |
commit | 223c31ce7dd962f43c580c89fa1966939557bc5c (patch) | |
tree | 1ebe6b791741c00c88f9e1dd2813a23c1a084c36 | |
parent | e80cbdc3224297ee57667e4000f1a671af05f520 (diff) | |
parent | 3ee3ec211e8aa78ad3c00e27b1c3965bad85b2ad (diff) | |
download | factory-boy-223c31ce7dd962f43c580c89fa1966939557bc5c.tar factory-boy-223c31ce7dd962f43c580c89fa1966939557bc5c.tar.gz |
Merge pull request #9 from kmike/test-improvements
Test running improvements
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | setup.py | 16 | ||||
-rw-r--r-- | tests/test_base.py | 6 | ||||
-rw-r--r-- | tests/test_containers.py | 5 | ||||
-rw-r--r-- | tests/test_declarations.py | 5 | ||||
-rw-r--r-- | tests/test_using.py | 5 | ||||
-rw-r--r-- | tests/test_utils.py | 5 | ||||
-rw-r--r-- | tox.ini | 11 |
8 files changed, 46 insertions, 8 deletions
@@ -8,3 +8,4 @@ htmlcov/ docs/_build docs/_static docs/_templates +.tox @@ -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' ], diff --git a/tests/test_base.py b/tests/test_base.py index a548b56..0788f82 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -20,7 +20,11 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest + import warnings from factory import base diff --git a/tests/test_containers.py b/tests/test_containers.py index 6e58573..a2a369d 100644 --- a/tests/test_containers.py +++ b/tests/test_containers.py @@ -20,7 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest from factory import base from factory import containers diff --git a/tests/test_declarations.py b/tests/test_declarations.py index 7215a54..3960670 100644 --- a/tests/test_declarations.py +++ b/tests/test_declarations.py @@ -20,7 +20,10 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest from factory.declarations import deepgetattr, OrderedDeclaration, Sequence diff --git a/tests/test_using.py b/tests/test_using.py index e6df3c2..fcd3aab 100644 --- a/tests/test_using.py +++ b/tests/test_using.py @@ -20,7 +20,10 @@ # THE SOFTWARE. """Tests using factory.""" -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest import factory diff --git a/tests/test_utils.py b/tests/test_utils.py index 543a6c0..c3047d3 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -21,7 +21,10 @@ # THE SOFTWARE. -import unittest +try: + import unittest2 as unittest +except ImportError: + import unittest from factory import utils @@ -0,0 +1,11 @@ +[tox] +envlist = py26,py27,pypy + +[testenv] +commands= + python setup.py test + +[testenv:py26] + +deps= + unittest2 |