Mercurial > piecrust2
comparison tests/conftest.py @ 86:1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 03 Sep 2014 17:28:10 -0700 |
parents | |
children | 76c838453dbe |
comparison
equal
deleted
inserted
replaced
85:3471ffa059b2 | 86:1cd67680c38c |
---|---|
1 import sys | |
2 import logging | |
3 | |
4 | |
5 def pytest_runtest_setup(item): | |
6 pass | |
7 | |
8 | |
9 def pytest_addoption(parser): | |
10 parser.addoption('--log-debug', action='store_true', | |
11 help="Sets the PieCrust logger to output debug info to stdout.") | |
12 | |
13 | |
14 def pytest_configure(config): | |
15 if config.getoption('--log-debug'): | |
16 hdl = logging.StreamHandler(stream=sys.stdout) | |
17 logging.getLogger('piecrust').addHandler(hdl) | |
18 logging.getLogger('piecrust').setLevel(logging.DEBUG) | |
19 |