[TIP] 'Mock' object is not iterable
andrea.crotti.0 at gmail.com
Mon Mar 26 06:04:49 PDT 2012
I'm trying to mock out a function which looks for orphaned pyc files in
So I created something like this
ret = Mock()
ret.pesky_pyc.return_value = ['b.pyc']
and the function I'm testing does this:
for pyc in Walker(directory).pesky_pyc():
but I get the error TypeError: 'Mock' object is not iterable
Actually also the non mocked version of Walker doesn't return a an
iterable from __init__, it's
pesky_pyc that returns an iterable, so why does it complain?
Any hint about how to fix it?
More information about the testing-in-python