From 94ec7d4816d2a243b8a2b0a0f2dc8a55a7347122 Mon Sep 17 00:00:00 2001 From: Jeff Schroeder Date: Sat, 30 Jun 2012 14:53:32 -0700 Subject: [PATCH 1/2] Make an error go to stderr and remove net 1 LOC --- tests/saltunittest.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/saltunittest.py b/tests/saltunittest.py index 736f78c875..3d5c6876ea 100644 --- a/tests/saltunittest.py +++ b/tests/saltunittest.py @@ -18,8 +18,7 @@ if sys.version_info[0:2] < (2, 7): TestCase, expectedFailure, \ TestSuite, skipIf except ImportError: - print("You need to install unittest2 to run the salt tests") - sys.exit(1) + raise SystemExit("You need to install unittest2 to run the salt tests") else: from unittest import TestLoader, TextTestRunner,\ TestCase, expectedFailure, \ From 5e854977601e9361e6022f43ae6c5a7b1a2993da Mon Sep 17 00:00:00 2001 From: Jeff Schroeder Date: Sat, 30 Jun 2012 14:53:55 -0700 Subject: [PATCH 2/2] Gracefully skip the django module tests w/o mock --- tests/integration/modules/django.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/integration/modules/django.py b/tests/integration/modules/django.py index 9f814bc69b..4893c9c1b2 100644 --- a/tests/integration/modules/django.py +++ b/tests/integration/modules/django.py @@ -5,15 +5,20 @@ Test the django module import sys # Import Salt libs -from saltunittest import TestLoader, TextTestRunner +from saltunittest import TestLoader, TextTestRunner, skipIf import integration from integration import TestDaemon from salt.modules import django django.__salt__ = {} -from mock import MagicMock, patch +try: + from mock import MagicMock, patch + has_mock = True +except ImportError: + has_mock = False +@skipIf(has_mock is False, "mock python module is unavailable") class DjangoModuleTest(integration.ModuleCase): ''' Test the django module