python-cffi: use shutil.which

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.
This commit is contained in:
David Bremner 2019-11-25 20:47:24 -04:00
parent 1e072204cd
commit 3185830e3a

View file

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