Re: Python3 cffi bindings

Subject: Re: Python3 cffi bindings

Date: Tue, 22 Oct 2019 13:32:32 -0300

To: Floris Bruynooghe, notmuch@notmuchmail.org

Cc:

From: David Bremner


David Bremner <david@tethera.net> 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
 
_______________________________________________
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch

Thread: