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 4E9106DE0EEA for ; Tue, 22 Oct 2019 09:32:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.058 X-Spam-Level: X-Spam-Status: No, score=-0.058 tagged_above=-999 required=5 tests=[AWL=-0.057, SPF_PASS=-0.001] 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 ogO1a5k5EX0h for ; Tue, 22 Oct 2019 09:32:39 -0700 (PDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by arlo.cworth.org (Postfix) with ESMTPS id 4DDB96DE0ECC for ; Tue, 22 Oct 2019 09:32:39 -0700 (PDT) Received: from remotemail by fethera.tethera.net with local (Exim 4.89) (envelope-from ) id 1iMx5G-0001ux-AC; Tue, 22 Oct 2019 12:32:34 -0400 Received: (nullmailer pid 22366 invoked by uid 1000); Tue, 22 Oct 2019 16:32:32 -0000 From: David Bremner To: Floris Bruynooghe , notmuch@notmuchmail.org Subject: Re: Python3 cffi bindings In-Reply-To: <878spfsj1t.fsf@tethera.net> References: <20191008210312.20685-1-flub@devork.be> <8736fvbivq.fsf@tethera.net> <87zhi3a46q.fsf@tethera.net> <877e53tgvc.fsf@powell.devork.be> <878spfsj1t.fsf@tethera.net> Date: Tue, 22 Oct 2019 13:32:32 -0300 Message-ID: <871rv4ivvj.fsf@tethera.net> 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: Tue, 22 Oct 2019 16:32:40 -0000 David Bremner writes: > The LD_LIBRARY_PATH is already set by the test harness, as is PATH (to > find notmuch). It looks like your function notmuch is not respecting > PATH (see attached log). if I hack something like > > diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py > index 1b7bbc35..ac17397c 100644 > --- a/bindings/python-cffi/tests/conftest.py > +++ b/bindings/python-cffi/tests/conftest.py > @@ -31,7 +31,7 @@ def notmuch(maildir): > accidentally do this in the unittests. > """ > cfg_fname = maildir.path / 'notmuch-config' > - cmd = ['notmuch'] + list(args) > + cmd = ['../../notmuch'] + list(args) > print('Invoking: {}'.format(' '.join(cmd))) > proc = subprocess.run(cmd, > I think I figured it out. Your 'run' function completely overrides the environment. But just adding PATH back seems to do the trick. I'm not sure if this is the most idomatic change, but it works: diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py index 1b7bbc35..6a81aa18 100644 --- a/bindings/python-cffi/tests/conftest.py +++ b/bindings/python-cffi/tests/conftest.py @@ -33,9 +33,11 @@ def notmuch(maildir): cfg_fname = maildir.path / 'notmuch-config' cmd = ['notmuch'] + list(args) print('Invoking: {}'.format(' '.join(cmd))) proc = subprocess.run(cmd, timeout=5, - env={'NOTMUCH_CONFIG': str(cfg_fname)}) + env={'PATH':os.environ["PATH"],'NOTMUCH_CONFIG': str(cfg_fname)}) proc.check_returncode() return run