
Might be, self._lmtp is creating new lmtp instance each time it executes sendmail( ) , or is there something else ?
I don't think it does. My first guess is that there's an exception getting masked.
I tried ./bin/test along with -e option , and did not see any of the exceptions being masked in lmtp runner process.
def test_function(self): self._lmtp.sendmail(.........) messages = get_queue_messages('in') self.assertEqual(len(messages), 1)
self._lmtp.sendmail(.........) messages = get_queue_messages('in') self.assertEqual(len(messages), 1)
I tried verifying the header of both the messages using self.assertEqual(messages[0].msg['Message-ID'], '<message_header>') and found out that both the messages sent from the test_func(self) are being recieved by the lmtp runner, but at any moment of time, there is only one message in the queue that is the latest one received.
I tried sending multiple message by attaching smtplib.LMTP() instance to the lmtp runner and was successful, as there were multiple messages that i sent were present in the queue. But doing the same thing in test_func() leads to only the latest message being left in the queue thus showing len(messages)=1 always.
I have fixed the bug regarding lmtp runner should reject messages with duplcate Message-ID, and just want to write a test for it by sending two messages with same ID.
Cheers, Sandesh