Blog

  • I was getting so frustrated. I knew how to raise the exception with side_effect=. But, how do you mock the exception? try: connection = connect_to_sqs except BotoServerError as m: if m.error_code == “AlreadyExistsException” To get it to work, I inherited the exception class – BotoServerError from boto.exceptions import BotoServerError class MockBotoServerError(BotoServerError): def __init__(self, error_code) self.error_code…