Skip to content

[feature-request] assert_wait_call_count method for calls from other threads #189

@GoogleCodeExporter

Description

@GoogleCodeExporter
When waiting for code in other threads to call mock methods, it would be nice 
if you could do something like:

import mock
import threading

m_fn = mock.Mock()

def caller(fn, num):
  for i in range(num):
    fn()

threading.Thread(target=caller, args=(m_fn, 3)).start()
m_fn.assert_wait_call_count(count=3, timeout=1.)

which should wait for up to timeout seconds for m_fn to be called count times, 
and raise an assertion error if it is not called at least count times within 
the timeout.


Original issue reported on code.google.com by nmar...@gmail.com on 15 Nov 2012 at 12:29

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions