diff options
Diffstat (limited to 'tests/unittests/test_templating.py')
| -rw-r--r-- | tests/unittests/test_templating.py | 19 | 
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py index 957467f6..fbad405f 100644 --- a/tests/unittests/test_templating.py +++ b/tests/unittests/test_templating.py @@ -16,6 +16,9 @@  #    You should have received a copy of the GNU General Public License  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. +from __future__ import print_function + +import sys  import six  import unittest @@ -24,6 +27,20 @@ import textwrap  from cloudinit import templater +try: +    skipIf = unittest.skipIf +except AttributeError: +    # Python 2.6.  Doesn't have to be high fidelity. +    def skipIf(condition, reason): +        def decorator(func): +            def wrapper(*args, **kws): +                if condition: +                    return func(*args, **kws) +                else: +                    print(reason, file=sys.stderr) +            return wrapper +        return decorator +  class TestTemplates(test_helpers.TestCase):      def test_render_basic(self): @@ -41,7 +58,7 @@ class TestTemplates(test_helpers.TestCase):          out_data = templater.basic_render(in_data, {'b': 2})          self.assertEqual(expected_data.strip(), out_data) -    @unittest.skipIf(six.PY3, 'Cheetah is not compatible with Python 3') +    @skipIf(six.PY3, 'Cheetah is not compatible with Python 3')      def test_detection(self):          blob = "## template:cheetah"  | 
