7

I have an interrupt handler within a class and following method:

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

when I press control + c I get the print message from my interruptHandler, so the method is fine. But when I write an pytest for it I dont know how to assert the SIGINT. And when I want to force the interrupt with

worker.interruptHandler(signal.sigint)

I get an error that I am missing the argument frame.

ubongo
  • 87
  • 5
  • Possible duplicate of [How to really test signal handling in Python?](https://stackoverflow.com/questions/26158373/how-to-really-test-signal-handling-in-python) – hoefling Nov 21 '18 at 10:45

0 Answers0