forked from pool/python-pyfuse3
Accepting request 893435 from home:ecsos
- Update to 3.2.0 - Fix long-standing rounding error in file date handling when the nanosecond part of file dates were > 999999500. - There is a new pyfuse3.terminate() function to gracefully end the main loop. - Changes from 3.1.1 - No source changes. Regenerated Cython files with Cython 0.29.21 for Python 3.9 compatibility. - Changes from 3.1.0 - Made compatible with newest Trio module. - Drop fix_catch_log_handler.patch because now in upstream. - Change source url to pythonhosted. OBS-URL: https://build.opensuse.org/request/show/893435 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pyfuse3?expand=0&rev=15
This commit is contained in:
@@ -1,113 +0,0 @@
|
||||
From 0070eddfc33fc2fba8eb4fe9353a2d2fa1ae575b Mon Sep 17 00:00:00 2001
|
||||
From: Nikolaus Rath <Nikolaus@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)
|
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:d6502c002213eb8654707718b37187c49d5d1d3fda9dac40397aa5948f1bb56a
|
||||
size 154877
|
3
pyfuse3-3.2.0.tar.gz
Normal file
3
pyfuse3-3.2.0.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:45f0053ad601b03a36e2c283a5271403674245a66a0daf50e3deaab0ea4fa82f
|
||||
size 465350
|
@@ -1,3 +1,19 @@
|
||||
-------------------------------------------------------------------
|
||||
Sun May 16 08:03:01 UTC 2021 - ecsos <ecsos@opensuse.org>
|
||||
|
||||
- Update to 3.2.0
|
||||
- Fix long-standing rounding error in file date handling when the
|
||||
nanosecond part of file dates were > 999999500.
|
||||
- There is a new pyfuse3.terminate() function to gracefully end
|
||||
the main loop.
|
||||
- Changes from 3.1.1
|
||||
- No source changes. Regenerated Cython files with Cython 0.29.21
|
||||
for Python 3.9 compatibility.
|
||||
- Changes from 3.1.0
|
||||
- Made compatible with newest Trio module.
|
||||
- Drop fix_catch_log_handler.patch because now in upstream.
|
||||
- Change source url to pythonhosted.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 15 18:11:55 UTC 2021 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
|
@@ -20,18 +20,16 @@
|
||||
%define skip_python2 1
|
||||
%define pname pyfuse3
|
||||
Name: python-%{pname}
|
||||
Version: 3.0.0
|
||||
Version: 3.2.0
|
||||
Release: 0
|
||||
Summary: Python Bindings for the low-level FUSE3 API
|
||||
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 mcepl@suse.com
|
||||
# works around the removed attribute of log handlers .catch_log_handler
|
||||
Patch0: fix_catch_log_handler.patch
|
||||
Source: https://files.pythonhosted.org/packages/source/p/%{pname}/%{pname}-%{version}.tar.gz
|
||||
BuildRequires: %{python_module Cython}
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module devel >= 3.5}
|
||||
BuildRequires: %{python_module pytest >= 3.4.0}
|
||||
# upstream use: pytest-trio >= 0.15
|
||||
BuildRequires: %{python_module pytest-trio}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: %{python_module trio}
|
||||
@@ -47,7 +45,7 @@ Recommends: fuse3 >= 3.3.0
|
||||
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
|
||||
%autosetup -p1 -n %{pname}-release-%{version}
|
||||
%autosetup -p1 -n %{pname}-%{version}
|
||||
|
||||
%build
|
||||
%python_expand $python setup.py build_cython
|
||||
|
Reference in New Issue
Block a user