From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 1A3976DE0F34 for ; Wed, 6 Nov 2019 12:51:49 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.404 X-Spam-Level: X-Spam-Status: No, score=0.404 tagged_above=-999 required=5 tests=[AWL=-0.248, SPF_NEUTRAL=0.652] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9lbP3x2yL6Az for ; Wed, 6 Nov 2019 12:51:47 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by arlo.cworth.org (Postfix) with ESMTP id 73D3E6DE0C3B for ; Wed, 6 Nov 2019 12:51:47 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id D5156100199; Wed, 6 Nov 2019 22:51:42 +0200 (EET) From: Tomi Ollila To: David Bremner , notmuch@notmuchmail.org Subject: Re: [PATCH 4/5] tests: run python-cffi tests In-Reply-To: <87h83hsq4o.fsf@tethera.net> References: <20191104013927.17037-1-david@tethera.net> <20191104013927.17037-5-david@tethera.net> <87h83hsq4o.fsf@tethera.net> User-Agent: Notmuch/0.28.3+84~g41389bb (https://notmuchmail.org) Emacs/25.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 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: Wed, 06 Nov 2019 20:51:49 -0000 On Tue, Nov 05 2019, David Bremner wrote: > Tomi Ollila writes: > > >> >> probably >> >> test_expect_success "${NOTMUCH_PYTHON} -m pytest \ >> --log-file=$TMP_DIRECTORY/test.output \ >> $NOTMUCH_SRCDIR/bindings/python-cffi/build/stage" >> >> worked (which reminds me out-of-tree... ;) >> > > despite looking prettier this does not work because it looks for the > "notdb" module in the current directory. It could work (maybe) if we set > PYTHONPATH. Would that be better than the 'cd'? So that would basically be: test_expect_success "PYTHONPATH=$PWD${PYTHONPATH:+:$PYTHONPATH} \ ${NOTMUCH_PYTHON} -m pytest \ --log-file=$TMP_DIRECTORY/test.output \ $NOTMUCH_SRCDIR/bindings/python-cffi/build/stage" (if it worked) perhaps 'cd' in subshell is clearer (i also wonder what --rootdir= does (and how new pytest is needed for that) >> It prints the version, then exists. Could not figure out how to request >> specific version in quick look (10 min search/trial/error session), >> parsing version output is so... :/ > > I think something like > > conf=$(mktemp) > printf "[pytest]\nminversion=3.0\n" > $conf > if pytest-3 -c $conf --version >/dev/null; then > have_pytest=1 > else > have_pytest=0 > fi > rm -f $(conf) > > should work. Right -- just that pytest-3 may not be available -- to iterate (tested)... if ${NOTMUCH_PYTHON} -m pytest -c $conf --version >/dev/null 2>&1; then (in this particular case redirecting both stdout and stderr is needed to silence noise in all 'ordinary' cases, being 1) pytest module not available -- silence stderr 2) pytest version not new enough -- silence stderr 3) pytest exists and is new enought -- silence stdout )