Removing pl_slice from decorator for PL node
[nepi.git] / test / lib / test_utils.py
index d314f6b..447c703 100644 (file)
@@ -83,4 +83,16 @@ def skipInteractive(func):
     
     return wrapped
 
+def skipIfNotPLCredentials(func):
+    name = func.__name__
+    def wrapped(*args, **kwargs):
+        pl_user = os.environ.get("PL_USER")
+        pl_pass = os.environ.get("PL_PASS")
+        if not (pl_user and pl_pass):
+            print "*** WARNING: Skipping test %s: Planetlab user, password and slicename not defined\n" % name
+            return
+
+        return func(*args, **kwargs)
+
+    return wrapped