|
1 Bug fixes in zc.buildout.testing |
|
2 ================================ |
|
3 |
|
4 Logging handler which did not get deleted |
|
5 ----------------------------------------- |
|
6 |
|
7 The buildout testing set up runs a buildout which adds a |
|
8 ``logging.StreamHandler`` to the root logger. But tear down did not |
|
9 remove it. This can disturb other tests of packages reusing |
|
10 zc.buildout.testing. |
|
11 |
|
12 The handers before calling set up are: |
|
13 |
|
14 >>> import logging |
|
15 >>> len(logging.getLogger().handlers) |
|
16 1 |
|
17 >>> logging.getLogger().handlers # doctest: +ELLIPSIS |
|
18 [<zope...testrunner.logsupport.NullHandler instance at ...>] |
|
19 |
|
20 After calling it, a ``logging.StreamHandler`` was added: |
|
21 |
|
22 >>> import zc.buildout.testing |
|
23 >>> import doctest |
|
24 >>> test = doctest.DocTestParser().get_doctest( |
|
25 ... '>>> x', {}, 'foo', 'foo.py', 0) |
|
26 >>> zc.buildout.testing.buildoutSetUp(test) |
|
27 >>> len(logging.getLogger().handlers) |
|
28 2 |
|
29 >>> logging.getLogger().handlers # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE |
|
30 [<zope...testrunner.logsupport.NullHandler instance at ...>, |
|
31 <logging.StreamHandler instance at ...>] |
|
32 |
|
33 But tear down removes the new logging handler: |
|
34 |
|
35 >>> zc.buildout.testing.buildoutTearDown(test) |
|
36 >>> len(logging.getLogger().handlers) |
|
37 1 |
|
38 >>> logging.getLogger().handlers # doctest: +ELLIPSIS |
|
39 [<zope...testrunner.logsupport.NullHandler instance at ...>] |