summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Options/Options.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 11:02:51 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2014-10-22 13:11:55 -0500
commit7a4dd4b3436cd85ee46acd07e85e7769f739b87f (patch)
tree7a6d4f1706ec4c40118d722dd2b697d70645e9a6 /src/lib/Bcfg2/Options/Options.py
parent1a54f2a549b86be5a976d2a43a7985c1265d916a (diff)
downloadbcfg2-7a4dd4b3436cd85ee46acd07e85e7769f739b87f.tar.gz
bcfg2-7a4dd4b3436cd85ee46acd07e85e7769f739b87f.tar.bz2
bcfg2-7a4dd4b3436cd85ee46acd07e85e7769f739b87f.zip
testsuite: better debug capturing for options tests
Diffstat (limited to 'src/lib/Bcfg2/Options/Options.py')
-rw-r--r--src/lib/Bcfg2/Options/Options.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Options/Options.py b/src/lib/Bcfg2/Options/Options.py
index 4efd76929..bd1a72fc7 100644
--- a/src/lib/Bcfg2/Options/Options.py
+++ b/src/lib/Bcfg2/Options/Options.py
@@ -17,14 +17,18 @@ from Bcfg2.Compat import ConfigParser
__all__ = ["Option", "BooleanOption", "PathOption", "PositionalArgument",
"_debug"]
+unit_test = False
+
def _debug(msg):
""" Option parsing happens before verbose/debug have been set --
they're options, after all -- so option parsing verbosity is
enabled by changing this to True. The verbosity here is primarily
of use to developers. """
- if os.environ.get('BCFG2_OPTIONS_DEBUG', '0').lower() in ["true", "yes",
- "on", "1"]:
+ if unit_test:
+ print("DEBUG: %s" % msg)
+ elif os.environ.get('BCFG2_OPTIONS_DEBUG', '0').lower() in ["true", "yes",
+ "on", "1"]:
sys.stderr.write("%s\n" % msg)