Bug in inorder.verify

30 views
Skip to first unread message

Alan Cabrera

unread,
Aug 17, 2012, 1:30:50 AM8/17/12
to mockito...@googlegroups.com
This does not seem to work

        inorder.verify(watcher).session_connected(any(long), any(str), False)
        inorder.verify(watcher).data_changed(self.chroot + '/pookie')
        inorder.verify(watcher).data_changed(self.chroot + '/pookie')
        inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
        inorder.verify(watcher).connection_closed()
        verifyNoMoreInteractions(watcher)

I get

  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/acabrera/dev/pookeeper/tests/test_client.py", line 278, in test_exists_watcher
    inorder.verify(watcher).data_changed(self.chroot + '/pookie')
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/invocation.py", line 98, in __call__
    verification.verify(self, len(matched_invocations))
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 79, in verify
    self.original_verification.verify(wanted_invocation, count)
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 56, in verify
    raise VerificationError("\nWanted times: %i, actual times: %i" % (self.wanted_count, actual_count))
VerificationError: 
Wanted times: 1, actual times: 2

which is an error on the first verify for data_changed().

If change the inorder calls to:

        inorder.verify(watcher).session_connected(any(long), any(str), False)
        inorder.verify(watcher, times=2).data_changed(self.chroot + '/pookie')
        inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
        inorder.verify(watcher).connection_closed()
        verifyNoMoreInteractions(watcher)

I get

Traceback (most recent call last):
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/Users/acabrera/dev/pookeeper/tests/test_client.py", line 279, in test_exists_watcher
    inorder.verify(watcher).node_deleted(self.chroot + '/pookie')
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/invocation.py", line 98, in __call__
    verification.verify(self, len(matched_invocations))
  File "/Users/acabrera/.virtualenvs/linkedin/lib/python2.6/site-packages/mockito-0.5.1-py2.6.egg/mockito/verification.py", line 75, in verify
    raise VerificationError("\nWanted %s to be invoked, got %s instead" % (wanted_invocation, invocation))
VerificationError: 
Wanted node_deleted('/pookeeper/pookie') to be invoked, got data_changed('/pookeeper/pookie') instead

Szczepan Faber

unread,
Sep 21, 2012, 2:45:50 PM9/21/12
to mockito...@googlegroups.com
Hey,

You've got to debug it yourself, I'm afraid :) We'll gladly accept a patch.

Cheers!
> --
> You received this message because you are subscribed to the Google Groups
> "mockito-python" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/mockito-python/-/IZ_1gqxrPS8J.
> To post to this group, send email to mockito...@googlegroups.com.
> To unsubscribe from this group, send email to
> mockito-pytho...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mockito-python?hl=en.



--
Szczepan Faber
Principal engineer@gradleware
Lead@mockito
Reply all
Reply to author
Forward
0 new messages