[Tutor] Pytest - Sounddevice callback function

Mats Wichmann mats at wichmann.us
Fri Oct 7 11:47:19 EDT 2022


On 10/6/22 15:37, Brian Wheatley wrote:
> Hello,
> 
> Is there any way to pytest a callback function, using the sounddevice
> library?
> I basically just want to test if the Inputstream is working.
> Or even assert that no exception is found.

Generally speaking, when the thing you want to test is "out of your 
control" - such as device input and callbacks in your case - you need to 
create a situation where the environment of the unit test *is* in your 
control.  mocking and monkeypatching are tools you can use to help with 
this.   That's a very general answer and certainly doesn't help with 
specific details (entirely unfamiliar with sounddevice).




More information about the Tutor mailing list