Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pyfuse3 for openSUSE:Factory checked in at 2021-03-16 15:45:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pyfuse3 (Old) and /work/SRC/openSUSE:Factory/.python-pyfuse3.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pyfuse3" Tue Mar 16 15:45:48 2021 rev:6 rq:879272 version:3.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pyfuse3/python-pyfuse3.changes 2020-08-14 13:10:56.837247186 +0200 +++ /work/SRC/openSUSE:Factory/.python-pyfuse3.new.2401/python-pyfuse3.changes 2021-03-16 15:46:48.621266520 +0100 @@ -1,0 +2,7 @@ +Mon Mar 15 18:11:55 UTC 2021 - Matej Cepl <mc...@suse.com> + +- Add fix_catch_log_handler.patch to make tests compatible with + pytest >= 6.0.0, which removed never documented attribute + .catch_log_handler of log item (gh#libfuse/pyfuse3#27). + +------------------------------------------------------------------- New: ---- fix_catch_log_handler.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pyfuse3.spec ++++++ --- /var/tmp/diff_new_pack.xljD8u/_old 2021-03-16 15:46:49.309267588 +0100 +++ /var/tmp/diff_new_pack.xljD8u/_new 2021-03-16 15:46:49.309267588 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pyfuse3 # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,10 +26,13 @@ License: LGPL-2.1-or-later URL: https://github.com/libfuse/pyfuse3 Source: https://github.com/libfuse/pyfuse3/archive/release-%{version}.tar.gz#/%{pname}-%{version}.tar.gz +# PATCH-FIX-UPSTREAM fix_catch_log_handler.patch gh#libfuse/pyfuse3#27 mc...@suse.com +# works around the removed attribute of log handlers .catch_log_handler +Patch0: fix_catch_log_handler.patch BuildRequires: %{python_module Cython} BuildRequires: %{python_module devel} +BuildRequires: %{python_module pytest >= 3.4.0} BuildRequires: %{python_module pytest-trio} -BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module trio} BuildRequires: fdupes @@ -44,7 +47,7 @@ pyfuse3 is a set of Python 3 bindings for libfuse 3. It provides an asynchronous API compatible with Trio and asyncio, and enables you to easily write a full-featured Linux filesystem in Python. %prep -%setup -q -n %{pname}-release-%{version} +%autosetup -p1 -n %{pname}-release-%{version} %build %python_expand $python setup.py build_cython ++++++ fix_catch_log_handler.patch ++++++ >From 0070eddfc33fc2fba8eb4fe9353a2d2fa1ae575b Mon Sep 17 00:00:00 2001 From: Nikolaus Rath <nikol...@rath.org> Date: Sat, 21 Nov 2020 11:39:46 +0000 Subject: [PATCH] Use fixtures instead of hooks for inspecting output. This should make us less dependent on pytest internals and compatible with pytest 6. Fixes: #27. --- setup.py | 2 - test/pytest_checklogs.py | 54 +++++++++++++---------------------------------- 2 files changed, 16 insertions(+), 40 deletions(-) --- a/setup.py +++ b/setup.py @@ -136,7 +136,7 @@ def main(): platforms=[ 'Linux' ], keywords=['FUSE', 'python' ], install_requires=['trio'], - tests_require=['pytest', 'pytest-trio'], + tests_require=['pytest >= 3.4.0', 'pytest-trio'], python_requires='>=3.5', package_dir={'': 'src'}, py_modules=['_pyfuse3', 'pyfuse3_asyncio'], --- a/test/pytest_checklogs.py +++ b/test/pytest_checklogs.py @@ -19,20 +19,7 @@ import functools import sys import logging from contextlib import contextmanager -from distutils.version import LooseVersion -def pytest_configure(config): - # pytest-catchlog was integrated in pytest 3.3.0 - if (LooseVersion(pytest.__version__) < "3.3.0" and - not config.pluginmanager.hasplugin('pytest_catchlog')): - raise ImportError('pytest catchlog plugin not found') - -# Fail tests if they result in log messages of severity WARNING or more. -def check_test_log(caplog): - for record in caplog.records: - if (record.levelno >= logging.WARNING and - not getattr(record, 'checklogs_ignore', False)): - raise AssertionError('Logger received warning messages') class CountMessagesHandler(logging.Handler): def __init__(self, level=logging.NOTSET): @@ -75,16 +62,12 @@ def assert_logs(pattern, level=logging.W logger.removeHandler(handler) if count is not None and handler.count != count: - raise AssertionError('Expected to catch %d %r messages, but got only %d' - % (count, pattern, handler.count)) + pytest.fail('Expected to catch %d %r messages, but got only %d' + % (count, pattern, handler.count)) def check_test_output(capfd, item): (stdout, stderr) = capfd.readouterr() - # Write back what we've read (so that it will still be printed) - sys.stdout.write(stdout) - sys.stderr.write(stderr) - # Strip out false positives try: false_pos = item.checklogs_fp @@ -101,10 +84,10 @@ def check_test_output(capfd, item): cp = re.compile(r'\b{}\b'.format(pattern), re.IGNORECASE | re.MULTILINE) hit = cp.search(stderr) if hit: - raise AssertionError('Suspicious output to stderr (matched "%s")' % hit.group(0)) + pytest.fail('Suspicious output to stderr (matched "%s")' % hit.group(0)) hit = cp.search(stdout) if hit: - raise AssertionError('Suspicious output to stdout (matched "%s")' % hit.group(0)) + pytest.fail('Suspicious output to stdout (matched "%s")' % hit.group(0)) def register_output(item, pattern, count=1, flags=re.MULTILINE): '''Register *pattern* as false positive for output checking @@ -121,21 +104,14 @@ def reg_output(request): request.node.checklogs_fp = [] return functools.partial(register_output, request.node) -def check_output(item): - pm = item.config.pluginmanager - cm = pm.getplugin('capturemanager') - capmethod = (getattr(cm, '_capturing', None) or - getattr(item, '_capture_fixture', None) or - getattr(cm, '_global_capturing', None)) - check_test_output(capmethod, item) - check_test_log(item.catch_log_handler) - -@pytest.hookimpl(trylast=True) -def pytest_runtest_setup(item): - check_output(item) -@pytest.hookimpl(trylast=True) -def pytest_runtest_call(item): - check_output(item) -@pytest.hookimpl(trylast=True) -def pytest_runtest_teardown(item, nextitem): - check_output(item) +# Autouse fixtures are instantiated before explicitly used fixtures, this should also +# catch log messages emitted when e.g. initializing resources in other fixtures. +@pytest.fixture(autouse=True) +def check_output(caplog, capfd, request): + yield + for when in ("setup", "call", "teardown"): + for record in caplog.get_records(when): + if (record.levelno >= logging.WARNING and + not getattr(record, 'checklogs_ignore', False)): + pytest.fail('Logger received warning messages.') + check_test_output(capfd, request)