Question on mock creation

11 views
Skip to first unread message

Yorgos Pagles

unread,
Mar 28, 2009, 1:50:45 PM3/28/09
to mockito-python
Hi,
I have used mockito for a few java projects and now I 've needed a
python mocking framework and after trying out mox I still find that
the mockito syntax comes more natural to me. I miss one thing though
from both mox and the java version of mockito. When I stub / mock a
class in python mockito there is no way to check if the method I am
stubbing or mocking is actually a part of the object I am mocking /
faking:

mock = Mock()
when(mock).foo() # what if the mocked class doesn't have a foo()
method?

I would like to see something like the following (AFAIR this is the
way of the java mockito):

mock = Mock(RealClass)
when(mock).foo() # fail if foo() method is not in RealClass

Would an approach like that feel interesting?

Regards,
Yorgos

szczepiq

unread,
Mar 30, 2009, 7:26:05 AM3/30/09
to mockito...@googlegroups.com
Hi,

I'm with you about this idea. This is something we have in TODO list
but it never topped the priority queue :)

Feel free to contribute this feature!

Cheers,
Szczepan Faber

Yorgos Pagles

unread,
Mar 31, 2009, 5:14:41 AM3/31/09
to mockito-python


On 30 Μαρ, 14:26, szczepiq <szcze...@gmail.com> wrote:
> Hi,
>
> I'm with you about this idea. This is something we have in TODO list
> but it never topped the priority queue :)

Good to hear that :-)

>
> Feel free to contribute this feature!

I will give it a shot. Do you have some procedure I should follow, or
just a patch here is fine?

>
> Cheers,
> Szczepan Faber

szczepiq

unread,
Mar 31, 2009, 5:41:16 AM3/31/09
to mockito...@googlegroups.com
I believe Bartosz opened an issue at mockito-python bitbucket site -
just attach your patch there.

Thanks!
Szczepan

2009/3/31 Yorgos Pagles <y.pa...@gmail.com>:

Bartosz Bańkowski

unread,
Mar 31, 2009, 5:44:08 AM3/31/09
to mockito...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages