'Returns the number of mails in maildir \'folder\'
Counting only those in cur&new (ignoring tmp).'

@classmethod
def count_maildir_mails(cls, folder):

    assert (cls.testdir != None)
    maildir = os.path.join(cls.testdir, 'mail', folder)
    (boxes, mails) = (0, 0)
    for (dirpath, dirs, files) in os.walk(maildir, False):
        if (set(dirs) == set(['cur', 'new', 'tmp'])):
            boxes += 1
        if dirpath.endswith(('/cur', '/new')):
            mails += len(files)
    return (boxes, mails)
