You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi thanks for publishing this project. We're doing something similar and I'd love to share some things that we've done.
pytest has better built-in support for logging, both capturing, live-logging, and writing to the junit-xml file (pytest-dev/pytest#3156). Log files are usually written in pytest_sessionfinish so we need them to propagate to the main process.
We solved this with the following:
## main process
class _ReEmitHandler(logging.Handler):
def handle(self, record):
logging.getLogger(record.name).handle(record)
log_queue = manager.Queue()
listener = logging.handlers.QueueListener(log_queue, _ReEmitHandler)
listener.start()
## subprocess
root = logging.getLogger()
root.handlers.clear()
root.addHandler(logging.handlers.QueueHandler(log_queue))
... run tests
Hi thanks for publishing this project. We're doing something similar and I'd love to share some things that we've done.
pytest has better built-in support for logging, both capturing, live-logging, and writing to the junit-xml file (pytest-dev/pytest#3156). Log files are usually written in
pytest_sessionfinishso we need them to propagate to the main process.We solved this with the following:
Interested in a PR?