userver: testsuite.utils.callinfo.AsyncCallQueue Class Reference
Loading...
Searching...
No Matches
testsuite.utils.callinfo.AsyncCallQueue Class Reference

Detailed Description

Function wrapper that puts information about function call into async queue.

This class provides methods to wait/check function underlying function calls.

Definition at line 29 of file callinfo.py.

Public Member Functions

 __init__ (self, typing.Callable func, *, name=None, CheckerType|None checker=None)
 func (self)
 Returns underlying function.
 __repr__ (self)
 __call__ (self, *args, **kwargs)
 Call underlying function.
None flush (self)
 Clear call queue.
bool has_calls (self)
 Returns True if call queue is not empty.
int times_called (self)
 Returns call queue length.
dict next_call (self)
 Pops call from queue and return its arguments dict.
dict wait_call (self, timeout=10.0)
 Wait for fucntion to be called.

Protected Member Functions

 _is_coro (self)
 _get_callinfo (self)
asyncio.Queue _queue (self)
 _check_callqueue (self, caller)

Protected Attributes

 _func = func
 _name = name or func.__name__
 _checker = checker
 _is_coro
 _queue = asyncio.Queue()

Constructor & Destructor Documentation

◆ __init__()

testsuite.utils.callinfo.AsyncCallQueue.__init__ ( self,
typing.Callable func,
* ,
name = None,
CheckerType | None checker = None )

Definition at line 37 of file callinfo.py.

Member Function Documentation

◆ __call__()

testsuite.utils.callinfo.AsyncCallQueue.__call__ ( self,
* args,
** kwargs )

Call underlying function.

Definition at line 68 of file callinfo.py.

◆ __repr__()

testsuite.utils.callinfo.AsyncCallQueue.__repr__ ( self)

Definition at line 65 of file callinfo.py.

◆ _check_callqueue()

testsuite.utils.callinfo.AsyncCallQueue._check_callqueue ( self,
caller )
protected

Definition at line 124 of file callinfo.py.

◆ _get_callinfo()

testsuite.utils.callinfo.AsyncCallQueue._get_callinfo ( self)
protected

Definition at line 58 of file callinfo.py.

◆ _is_coro()

testsuite.utils.callinfo.AsyncCallQueue._is_coro ( self)
protected

Definition at line 54 of file callinfo.py.

◆ _queue()

asyncio.Queue testsuite.utils.callinfo.AsyncCallQueue._queue ( self)
protected

Definition at line 62 of file callinfo.py.

◆ flush()

None testsuite.utils.callinfo.AsyncCallQueue.flush ( self)

Clear call queue.

Definition at line 77 of file callinfo.py.

◆ func()

testsuite.utils.callinfo.AsyncCallQueue.func ( self)

Returns underlying function.

Definition at line 49 of file callinfo.py.

◆ has_calls()

bool testsuite.utils.callinfo.AsyncCallQueue.has_calls ( self)

Returns True if call queue is not empty.

Definition at line 82 of file callinfo.py.

◆ next_call()

dict testsuite.utils.callinfo.AsyncCallQueue.next_call ( self)

Pops call from queue and return its arguments dict.

Raises CallQueueError if queue is empty

Definition at line 93 of file callinfo.py.

◆ times_called()

int testsuite.utils.callinfo.AsyncCallQueue.times_called ( self)

Returns call queue length.

Definition at line 88 of file callinfo.py.

◆ wait_call()

dict testsuite.utils.callinfo.AsyncCallQueue.wait_call ( self,
timeout = 10.0 )

Wait for fucntion to be called.

Pops call from queue. Blocks if it's empty.

:param timeout: timeout in seconds

Raises CallQueueTimeoutError if queue is empty for timeout seconds.

Definition at line 106 of file callinfo.py.

Member Data Documentation

◆ _checker

testsuite.utils.callinfo.AsyncCallQueue._checker = checker
protected

Definition at line 46 of file callinfo.py.

◆ _func

testsuite.utils.callinfo.AsyncCallQueue._func = func
protected

Definition at line 44 of file callinfo.py.

◆ _is_coro

testsuite.utils.callinfo.AsyncCallQueue._is_coro
protected

Definition at line 71 of file callinfo.py.

◆ _name

testsuite.utils.callinfo.AsyncCallQueue._name = name or func.__name__
protected

Definition at line 45 of file callinfo.py.

◆ _queue

testsuite.utils.callinfo.AsyncCallQueue._queue = asyncio.Queue()
protected

Definition at line 79 of file callinfo.py.


The documentation for this class was generated from the following file: