Skip to content

Commit 0562d92

Browse files
committed
Add workaround for broken syslog handler. Fixes #20.
1 parent e0b28d7 commit 0562d92

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pytest_services/log.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,21 @@ def services_log(slave_id):
2020
pass
2121
logger = logging.getLogger('[{slave_id}] {name}'.format(name=__name__, slave_id=slave_id))
2222
logger.setLevel(logging.DEBUG)
23-
if handler:
23+
if handler and workaround_issue_20(handler):
2424
logger.propagate = 0
2525
logger.addHandler(handler)
2626
return logger
2727

2828

29+
def workaround_issue_20(handler):
30+
"""
31+
Workaround for
32+
https://github.com/pytest-dev/pytest-services/issues/20,
33+
disabling installation of a broken handler.
34+
"""
35+
return hasattr(handler, 'socket')
36+
37+
2938
@contextlib.contextmanager
3039
def dont_capture(request):
3140
"""Suspend capturing of stdout by pytest."""

0 commit comments

Comments
 (0)