1
0
Fork 0

Adding a more-versatile condition-handling method for preventing integration tests from mashing on one another.

This commit is contained in:
Adam Coddington 2015-07-07 22:22:15 -07:00
parent 3e1f6b9909
commit 988cb7504f
6 changed files with 17 additions and 17 deletions

View file

@ -28,7 +28,7 @@ class Pop3Transport(EmailTransport):
return six.binary_type('\r\n', 'ascii').join(message_lines)
return '\r\n'.join(message_lines)
def get_message(self):
def get_message(self, condition=None):
message_count = len(self.server.list()[1])
for i in range(message_count):
try:
@ -36,6 +36,10 @@ class Pop3Transport(EmailTransport):
self.server.retr(i + 1)[1]
)
message = self.get_email_from_bytes(msg_contents)
if condition and not condition(message):
continue
yield message
except MessageParseError:
continue