Re: [PATCH 1/2] Show which notmuch command and version is being used
On Mon 18 Nov 2019 at 07:43 -0400, David Bremner wrote: > Floris Bruynooghe writes: > >> This add the notmuch version and absolute path of the binary used >> in the pytest header. This is nice when running the tests >> interactively as you get confirmation you're testing the version you >> thought you were testing. >> --- >> bindings/python-cffi/tests/conftest.py | 7 +++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/bindings/python-cffi/tests/conftest.py >> b/bindings/python-cffi/tests/conftest.py >> index aa940947..674c7218 100644 >> --- a/bindings/python-cffi/tests/conftest.py >> +++ b/bindings/python-cffi/tests/conftest.py >> @@ -10,6 +10,13 @@ import os >> import pytest >> >> >> +def pytest_report_header(): >> +vers = subprocess.run(['notmuch', '--version'], stdout=subprocess.PIPE) >> +which = subprocess.run(['which', 'notmuch'], stdout=subprocess.PIPE) > > I think it would be better to use "shutil.which()" here, to avoid > variations in shell builtin vs executable which. If you agree I can make > the change. Oh nice, I always forget about shutil. Please do make the change. Thanks, Floris ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH 1/2] Show which notmuch command and version is being used
Floris Bruynooghe writes: > This add the notmuch version and absolute path of the binary used > in the pytest header. This is nice when running the tests > interactively as you get confirmation you're testing the version you > thought you were testing. > --- > bindings/python-cffi/tests/conftest.py | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/bindings/python-cffi/tests/conftest.py > b/bindings/python-cffi/tests/conftest.py > index aa940947..674c7218 100644 > --- a/bindings/python-cffi/tests/conftest.py > +++ b/bindings/python-cffi/tests/conftest.py > @@ -10,6 +10,13 @@ import os > import pytest > > > +def pytest_report_header(): > +vers = subprocess.run(['notmuch', '--version'], stdout=subprocess.PIPE) > +which = subprocess.run(['which', 'notmuch'], stdout=subprocess.PIPE) I think it would be better to use "shutil.which()" here, to avoid variations in shell builtin vs executable which. If you agree I can make the change. ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
[PATCH 1/2] Show which notmuch command and version is being used
This add the notmuch version and absolute path of the binary used in the pytest header. This is nice when running the tests interactively as you get confirmation you're testing the version you thought you were testing. --- bindings/python-cffi/tests/conftest.py | 7 +++ 1 file changed, 7 insertions(+) diff --git a/bindings/python-cffi/tests/conftest.py b/bindings/python-cffi/tests/conftest.py index aa940947..674c7218 100644 --- a/bindings/python-cffi/tests/conftest.py +++ b/bindings/python-cffi/tests/conftest.py @@ -10,6 +10,13 @@ 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.""" -- 2.24.0 ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch