mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
11cc43d22d
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.
23 lines
702 B
Python
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
|