From: Lucia Guevgeozian Odizzio Date: Fri, 6 Dec 2013 18:12:33 +0000 (+0100) Subject: Adding decorator for skiping tests when no pl credentials X-Git-Tag: nepi-3.0.0~1^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=0483cd8516ab0b81fff242af6d5df4ade6092241;p=nepi.git Adding decorator for skiping tests when no pl credentials --- diff --git a/test/lib/test_utils.py b/test/lib/test_utils.py index d314f6b2..e783a626 100644 --- a/test/lib/test_utils.py +++ b/test/lib/test_utils.py @@ -83,4 +83,17 @@ 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") + pl_slice = os.environ.get("PL_SLICE") + if not (pl_user and pl_pass and pl_slice): + print "*** WARNING: Skipping test %s: Planetlab user, password and slicename not defined\n" % name + return + + return func(*args, **kwargs) + + return wrapped