Python Forum
Testing function calls - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Testing function calls (/thread-11775.html)



Testing function calls - jenselme - Jul-25-2018

Hi all,

Does someone know a nice library to test function calls? I am looking for something more expressive than the unittest module provides.

I'd like to do things like (in pytest notation)
assert func.called.times(2).with('foo')
or
assert func.called(nth=1).with('bar'))
. I confess that I'm influnced by JS libraries like jasmine and even mockery in PHP.


RE: Testing function calls - Larz60+ - Jul-25-2018

you can see if anything here: https://pypi.org/search/?q=testing
is suitable.