salt/tests/saltunittest.py
Evan Borgstrom 11cc43d22d Now that it's working let's make it a little nicer to use [GH-522]
This allows for tests to be written without too much change from the
normal unittest workflow. Now they should use the 'saltunittest'
namespace and we will need to import anything we need from the original
'unittest' or 'unittest2' namespace.
2012-01-29 10:17:51 -05:00

23 lines
702 B
Python

"""
This file provides a single interface to unittest objects for our
tests while supporting python < 2.7 via unittest2.
If you need something from the unittest namespace it should be
imported here from the relevant module and then imported into your
test from here
"""
import sys
# support python < 2.7 via unittest2
if sys.version_info[0:2] < (2,7):
try:
from unittest2 import TestLoader, TextTestRunner,\
TestCase, expectedFailure
except ImportError:
print "You need to install unittest2 to run the salt tests"
sys.exit(1)
else:
from unittest import TestLoader, TextTestRunner,\
TestCase, expectedFailure