Search Results

Search found 2 results on 1 pages for 'mox'.

Page 1/1 | 1 

  • How do I mock a class property with mox?

    - by Harley
    I have a class: class myclass(object): @property def myproperty(self): return 'hello' Using mox and py.test, how do I mock out myproperty? I've tried: mock.StubOutWithMock(myclass, 'myproperty') myclass.myproperty = 'goodbye' and mock.StubOutWithMock(myclass, 'myproperty') myclass.myproperty.AndReturns('goodbye') but both fail with AttributeError: can't set attribute.

    Read the article

1