← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~chad.smith/cloud-init:cleanup/py26-skipif into cloud-init:master

 

Chad Smith has proposed merging ~chad.smith/cloud-init:cleanup/py26-skipif into cloud-init:master.

Commit message:
Fix the built-in cloudinit/tests/helpers:skipIf

this version uses unittest2 skipIf which is present in our python 2.6
environment.

Author: Scott Moser <smoser@xxxxxxxxxx>

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/354070
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:cleanup/py26-skipif into cloud-init:master.
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index 5bfe7fa..dcd2be1 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -33,6 +33,7 @@ from cloudinit import util
 
 # Used for skipping tests
 SkipTest = unittest2.SkipTest
+skipIf = unittest2.skipIf
 
 # Used for detecting different python versions
 PY2 = False
@@ -426,21 +427,6 @@ def readResource(name, mode='r'):
 
 
 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
-
-
-try:
     import jsonschema
     assert jsonschema  # avoid pyflakes error F401: import unused
     _missing_jsonschema_dep = False

References