# HG changeset patch # User Ludovic Chabant # Date 1409790490 25200 # Node ID 1cd67680c38cb52158c5c56f4fd96201289007d1 # Parent 3471ffa059b2bb94b7b4a21155794c90256121ff Ability to output debug logging to `stdout` when running unit-tests. diff -r 3471ffa059b2 -r 1cd67680c38c tests/conftest.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/conftest.py Wed Sep 03 17:28:10 2014 -0700 @@ -0,0 +1,19 @@ +import sys +import logging + + +def pytest_runtest_setup(item): + pass + + +def pytest_addoption(parser): + parser.addoption('--log-debug', action='store_true', + help="Sets the PieCrust logger to output debug info to stdout.") + + +def pytest_configure(config): + if config.getoption('--log-debug'): + hdl = logging.StreamHandler(stream=sys.stdout) + logging.getLogger('piecrust').addHandler(hdl) + logging.getLogger('piecrust').setLevel(logging.DEBUG) +