Add context manager to enable mocking of signal handlers