Skip to content

Commit 059da16

Browse files
authored
Merge pull request #32 from pytest-dev/bugfix/20-syslog-error
Workaround errors in SysLogHandler
2 parents e0b28d7 + 7b36dfc commit 059da16

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

CHANGES.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Changelog
22
=========
33

4+
2.0.1
5+
-----
6+
7+
- #20: Added workaround for issue with SysLogHandler.
8+
49
2.0.0
510
-----
611

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)