Mercurial > piecrust2
annotate tests/conftest.py @ 154:a42469dbdc47
Match routes completely, not partially.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 27 Dec 2014 16:47:44 -0800 |
parents | 1cd67680c38c |
children | 76c838453dbe |
rev | line source |
---|---|
86
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import sys |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 import logging |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 def pytest_runtest_setup(item): |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 pass |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 def pytest_addoption(parser): |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 parser.addoption('--log-debug', action='store_true', |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 help="Sets the PieCrust logger to output debug info to stdout.") |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
14 def pytest_configure(config): |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
15 if config.getoption('--log-debug'): |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 hdl = logging.StreamHandler(stream=sys.stdout) |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
17 logging.getLogger('piecrust').addHandler(hdl) |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
18 logging.getLogger('piecrust').setLevel(logging.DEBUG) |
1cd67680c38c
Ability to output debug logging to `stdout` when running unit-tests.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
19 |