Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7111A429E21 for ; Mon, 2 Jan 2012 06:47:29 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Date" X-Spam-Flag: NO X-Spam-Score: -0.367 X-Spam-Level: X-Spam-Status: No, score=-0.367 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, INVALID_DATE=0.432, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SiC5QUfQDf2D for ; Mon, 2 Jan 2012 06:47:28 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B9380431FD0 for ; Mon, 2 Jan 2012 06:47:27 -0800 (PST) Received: by wibhq2 with SMTP id hq2so10049238wib.26 for ; Mon, 02 Jan 2012 06:47:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=content-type:mime-version:content-transfer-encoding:from:to :references:in-reply-to:date:message-id:subject:date; bh=rfg82aSvQgnvljEnHE2px0FOWzBtbGDUOSdoyn0F7sE=; b=JxKzHKN2AIkgLCJyx5xs289UcyhHPDtDl/hCT5Kf/IAhSuk04TOUsT2rgSZSLfpS3N LOkFXIEqTbweQ1bpfKm+RuAipEdSHpqbGJRTIhxvTv81T5e+aRs8NVSAhpHBw9OirQxg EDE/4lqzQhisELa3i/ZmUWjBaTnWQo4ePXFPg= Received: by 10.180.8.229 with SMTP id u5mr106420635wia.9.1325515646453; Mon, 02 Jan 2012 06:47:26 -0800 (PST) Received: from localhost (cpc1-sgyl2-0-0-cust548.18-2.cable.virginmedia.com. [82.41.10.37]) by mx.google.com with ESMTPS id f19sm30172758wbo.13.2012.01.02.06.47.23 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 02 Jan 2012 06:47:24 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Patrick Totzke To: Thomas Jost , Dmitry Kurochkin , notmuch@notmuchmail.org References: <1323251178-20409-1-git-send-email-schnouki@schnouki.net> <877h236tpx.fsf@gmail.com> <87liqgqtep.fsf@thor.loria.fr> In-Reply-To: <87liqgqtep.fsf@thor.loria.fr> Date: Mon, 02 Jan 2012 14:47:22 -0000 Message-ID: <20120102144722.18163.37346@brick.lan> Subject: Re: [PATCH 1/2] test: add a function to run Python tests Date: Mon, 02 Jan 2012 14:47:22 +0000 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Jan 2012 14:47:29 -0000 Quoting Thomas Jost (2011-12-13 17:21:34) >On Sun, 11 Dec 2011 18:58:18 +0400, Dmitry Kurochkin wrote: >> Perhaps we should have a test-lib.py for test-specific stuff like this >> (similar to test-lib.el)? I think it would be cleaner and makes it easy >> to add more Python test auxiliary functions later. > >Well, right now that would probably be overkill: the stdout-to-file >redirection takes 3 lines at most. Besides we would still need to set >some environment variables to run python with the correct directories. >But of course if we need to add more helper functions for running python >tests, then a test-lib.py would be nice. I agree that a test-lib python module that contains some helpers would be u= seful. Specifically, we could use a "test_expect_success" helper that wraps a given script into a try/except block. >Maybe we could even think about using one of Python's unit test libs for >that: doctest, unittest (both in the standard library) and nose seem to >be the most popular ones. never used any of these. I cleaned up the initial test a bit (see the following messages for the pat= ches). Here are a few suggestions for tests we should implement later: test_begin_subtest "tag messages" # add_tag/remove_tag = test_begin_subtest "add messages" # compare msg.get_filename to original = test_begin_subtest "find message" = test_begin_subtest "remove messages" = test_begin_subtest "list tags" # get_all_tags() = test_begin_subtest "count messages" # count_messages() = test_begin_subtest "count threads" # MISSING in the bindings! count_messag= es() = test_begin_subtest "count messages in thread" # get_total_messages compare = with notmuch search messages |wc = test_begin_subtest "exceptions" # ReadOnlyDatabaseError, XapianError. = test_begin_subtest "format message content" # format_message_as_text(indent= =3D0) best, /p