Skip to content

Nice-to-have: stubbing constructors #49

Description

@jonathan-benn

It would be nice to be able to stub a constructor, such as in this code:

import urllib2
import sinon
stub = sinon.stub(urllib2, 'Request')

This kind of behaviour came for free in Sinon.JS because, in JavaScript, constructors are also functions. In Python we'd have to make a special case for handling constructors.

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