python-如何测试interruptHandler是否与pytest一起工作?
我在一个类中有一个中断处理程序和以下方法:python-如何测试interruptHandler是否与pytest一起工作?,python,pytest,interrupt,Python,Pytest,Interrupt,我在一个类中有一个中断处理程序和以下方法: def interruptHandler(self, signal, frame): """ Catches SIGINT and SIGTERM to allow proper shutdown of all threads etc.""" self.stopWorker() print("interrupt") # the print message is just for me to see if it works 当我
def interruptHandler(self, signal, frame):
""" Catches SIGINT and SIGTERM to allow proper shutdown of all threads etc."""
self.stopWorker()
print("interrupt") # the print message is just for me to see if it works
当我按下control+c时,我从中断处理程序中得到打印消息,所以这个方法很好。但是当我为它编写pytest时,我不知道如何断言SIGINT。
当我想强行打断你的话
worker.interruptHandler(signal.sigint)
我得到一个错误,我缺少参数框。可能重复