Skip to content

StubOutClassWithMocks does not work with abstract base classes (ABC) #47

Closed
@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?
Create a file foo.py containing the following class definitions:
import abc

class Foo(object):
  __metaclass__ = abc.ABCMeta

class Bar(Foo):
  pass

Now execute the following:
import foo
import mox
mox.Mox().StubOutClassWithMocks(foo, 'Foo')

What is the expected output?
StubOutClassWithMocks() should not produce any errors.

What do you see instead?
Raises "TypeError: Given attr is not a Class.  Use StubOutWithMock."

Reason: type(foo.Foo) is <class 'abc.ABCMeta'>, which doesn't fall into any of 
the categories in _USE_MOCK_FACTORY.

Original issue reported on code.google.com by openvcd...@gmail.com on 12 Apr 2012 at 11:53

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions