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. --- tests/test_base.py | 6 +++++- tests/test_containers.py | 5 ++++- tests/test_declarations.py | 5 ++++- tests/test_using.py | 5 ++++- tests/test_utils.py | 5 ++++- 5 files changed, 21 insertions(+), 5 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3