]> git.notmuchmail.org Git - notmuch/blobdiff - bindings/python-cffi/tests/conftest.py
Show which notmuch command and version is being used
[notmuch] / bindings / python-cffi / tests / conftest.py
index 1b7bbc35ddb98803de1f766ecc894a73941201fc..674c72187078507b57edb0070a73aef635397ac7 100644 (file)
@@ -5,10 +5,18 @@ import socket
 import subprocess
 import textwrap
 import time
+import os
 
 import pytest
 
 
+def pytest_report_header():
+    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())]
+
+
 @pytest.fixture(scope='function')
 def tmppath(tmpdir):
     """The tmpdir fixture wrapped in pathlib.Path."""
@@ -32,10 +40,11 @@ def notmuch(maildir):
         """
         cfg_fname = maildir.path / 'notmuch-config'
         cmd = ['notmuch'] + list(args)
-        print('Invoking: {}'.format(' '.join(cmd)))
+        env = os.environ.copy()
+        env['NOTMUCH_CONFIG'] = str(cfg_fname)
         proc = subprocess.run(cmd,
                               timeout=5,
-                              env={'NOTMUCH_CONFIG': str(cfg_fname)})
+                              env=env)
         proc.check_returncode()
     return run