From 0483cd8516ab0b81fff242af6d5df4ade6092241 Mon Sep 17 00:00:00 2001 From: Lucia Guevgeozian Odizzio Date: Fri, 6 Dec 2013 19:12:33 +0100 Subject: [PATCH] Adding decorator for skiping tests when no pl credentials --- test/lib/test_utils.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 -- 2.47.0