Skip to content

Cannot stub logging with open stream #48

Description

@jonathan-benn

I'm not 100% sure this is a bug, or just something that we can't do anything about. But it's possible that a different internal implementation would allow the following code to execute.

This code succeeds:

import sinon
import logging
log = logging.getLogger('test')
stub = sinon.stub(log, 'warning')

This code fails:

import sinon
import logging
import sys
log = logging.getLogger('test')
streamHandler = logging.StreamHandler(sys.stdout)
log.addHandler(streamHandler)
stub = sinon.stub(log, 'warning') # raises "TypeError: can't pickle thread.lock objects"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions