[TIP] (Unit | Functional) testing of imaplib apps .

Olemis Lang olemis at gmail.com
Wed Nov 10 06:10:12 PST 2010


On Wed, Nov 10, 2010 at 8:39 AM, Menno Smits <menno at freshfoo.com> wrote:
> On 11/01/2010 07:31 PM, Tom Wardill wrote:
>> On Mon, 2010-11-01 at 08:46 -0500, Olemis Lang wrote:
>>>
>>> Hi !
>>>
>>> I'm developing an IMAP4-based app using `imaplib` . I'd like to know
>>> what's used to either mock (for unit tests) or launch a lightweight
>>> (in-memory ?) IMAP server (for functional tests), and how to
>>> setup all this at testing-time.
>>>
>>> Right now what I do is to use a local `hMailServer` instance on
>>> Windows , but it's so «lightweight» that I even had to install
>>> MySql and ... to make it work . So I'm hoping there's something
>>> out there like `twill` or `wsgi_intercept` that may help under
>>> these circumstances .
>>>
>>
>> Hi.
>>
>> In a similar situation, I created this:
>>
>> http://github.com/tomwardill/FakeEmail
>>
>> It's a standalone server, using twisted to run, so perhaps not as
>> lightweight as could be, but is in memory (and multi threaded), and
>
[...]
>
> Very interesting! I might use this to extend the functional testing of
> IMAPClient[1]. Right now I've been running automated tests against test
> accounts on various real IMAP servers. This is valuable because there's
> differences in behavior between different IMAP implementations but it also
> means that I'm not the only one who runs then functional tests because not
> many people have multiple test accounts lying around.
>

;o)

I suppose it would also be possible to elaborate on this and simulate
in-memory the behavior of poorly (or outside-standard) implemented
IMAP clients (e.g. MS Outlook 2k* always hangs with hMailServer
whereas Outlook Express doesn't ... but other IMAP servers work ok
with both)

> A little off topic but Olemis, if you're not too far down the track with
> your project you may want to consider using IMAPClient instead of imaplib.
> It will make your life a lot easier - imaplib is a real pain to use.
>
> [1] - http://imapclient.freshfoo.com/
>

Thnx for the pointer.

Already have , since the beginning ;o)
Nonetheless it makes no difference (from test setup perspective) so I
asked for imaplib (which was std)

**** Prepare for commercial

IMAPclient is invaluable . It's helps a lot with i18n and bizarre
characters (e.g. es_ES std folder «Correo electrónico no deseado» ),
and with handling many other commands easily.

Sexy lady now starts saying: If developing imaplib-based clients then
IMAPClient is *THE* way to go .

**** End of commercial , back to TiP

:)

PS: I confess , I was even thinking of sending some messages (doubts)
to you, but I could defeat the dragon ...

:o)

Keep up the good work !!!

If I come up with something interesting that I can contribute back to
the project, then I'll let you know ... ;o)

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list