]> git.notmuchmail.org Git - notmuch/commitdiff
python-cffi: use shutil.which
authorDavid Bremner <david@tethera.net>
Tue, 26 Nov 2019 00:47:24 +0000 (20:47 -0400)
committerDavid Bremner <david@tethera.net>
Tue, 3 Dec 2019 12:12:30 +0000 (08:12 -0400)
I was supposed to amend the original patch that added this function,
but somehow I botched that. The original version runs, so make an
extra commit for the tidying.

bindings/python-cffi/tests/conftest.py

index 674c72187078507b57edb0070a73aef635397ac7..e322cc647167e917b99a8a537b4c9b1b7100a04b 100644 (file)
@@ -1,6 +1,7 @@
 import email.message
 import mailbox
 import pathlib
+import shutil
 import socket
 import subprocess
 import textwrap
@@ -11,10 +12,9 @@ import pytest
 
 
 def pytest_report_header():
+    which = shutil.which('notmuch')
     vers = subprocess.run(['notmuch', '--version'], stdout=subprocess.PIPE)
-    which = subprocess.run(['which', 'notmuch'], stdout=subprocess.PIPE)
-    return ['{} ({})'.format(vers.stdout.decode(errors='replace').strip(),
-                             which.stdout.decode(errors='replace').strip())]
+    return ['{} ({})'.format(vers.stdout.decode(errors='replace').strip(),which)]
 
 
 @pytest.fixture(scope='function')