Python3 cffi bindings

David Bremner david at tethera.net
Tue Oct 22 09:32:32 PDT 2019


David Bremner <david at 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
 


More information about the notmuch mailing list