From 302e1d29d82570ec32fd066bb9038649a67d148b Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Wed, 29 Sep 2010 14:53:12 +0300 Subject: s4-python-test: Common implementation for getting environment variable value Unit-test based python tests require certain input parameters to be set in environment, otherwise they can't be run --- source4/scripting/python/samba/tests/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/source4/scripting/python/samba/tests/__init__.py b/source4/scripting/python/samba/tests/__init__.py index bf7c563c4e..7a5c2aa694 100644 --- a/source4/scripting/python/samba/tests/__init__.py +++ b/source4/scripting/python/samba/tests/__init__.py @@ -68,6 +68,17 @@ def env_loadparm(): raise Exception("SMB_CONF_PATH not set") return lp +def env_get_var_value(var_name): + """Returns value for variable in os.environ + + Function throws AssertionError if variable is defined. + Unit-test based python tests require certain input params + to be set in environment, otherwise they can't be run + """ + assert var_name in os.environ.keys(), "Please supply %s in environment" % var_name + return os.environ[var_name] + + cmdline_credentials = None class RpcInterfaceTestCase(TestCase): -- cgit