From: Matthias Goergens Date: Fri, 7 Apr 2023 07:39:21 +0000 (+0800) Subject: Fix PytestReturnNotNoneWarning X-Git-Tag: fuse-3.15.0~21 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6ce27f48bc6bb797c4d3953572e00e9579f0af87;p=qemu-gpiodev%2Flibfuse.git Fix PytestReturnNotNoneWarning ``` test_examples.py::test_printcap /usr/local/lib/python3.9/dist-packages/_pytest/python.py:199: PytestReturnNotNoneWarning: Expected None, but test_examples.py::test_printcap returned ((7, 38), {'FUSE_CAP_READDIRPLUS_AUTO', 'FUSE_CAP_ASYNC_DIO', 'FUSE_CAP_SPLICE_READ', 'FUSE_CAP_CACHE_SYMLINKS', 'FUSE_CAP_IOCTL_DIR', 'FUSE_CAP_NO_OPENDIR_SUPPORT', 'FUSE_CAP_NO_OPEN_SUPPORT', 'FUSE_CAP_POSIX_LOCKS', 'FUSE_CAP_READDIRPLUS', 'FUSE_CAP_POSIX_ACL', 'FUSE_CAP_ATOMIC_O_TRUNC', 'FUSE_CAP_SPLICE_MOVE', 'FUSE_CAP_EXPORT_SUPPORT', 'FUSE_CAP_FLOCK_LOCKS', 'FUSE_CAP_EXPLICIT_INVAL_DATA', 'FUSE_CAP_EXPIRE_ONLY', 'FUSE_CAP_DONT_MASK', 'FUSE_CAP_WRITEBACK_CACHE', 'FUSE_CAP_AUTO_INVAL_DATA', 'FUSE_CAP_PARALLEL_DIROPS', 'FUSE_CAP_SPLICE_WRITE', 'FUSE_CAP_ASYNC_READ'}), which will be an error in a future version of pytest. Did you mean to use `assert` instead of `return`? warnings.warn( ``` --- diff --git a/test/util.py b/test/util.py index 8bef265..0a1fa93 100644 --- a/test/util.py +++ b/test/util.py @@ -11,7 +11,7 @@ import itertools basename = pjoin(os.path.dirname(__file__), '..') -def test_printcap(): +def get_printcap(): cmdline = base_cmdline + [ pjoin(basename, 'example', 'printcap') ] proc = subprocess.Popen(cmdline, stdout=subprocess.PIPE, universal_newlines=True) @@ -31,6 +31,8 @@ def test_printcap(): return (proto, caps) +def test_printcap(): + get_printcap() def wait_for_mount(mount_process, mnt_dir, test_fn=os.path.ismount): @@ -163,7 +165,7 @@ os.environ['PATH'] = '%s:%s' % (pjoin(basename, 'util'), os.environ['PATH']) os.environ['PATH'] = '%s:%s' % (pjoin(basename, 'example'), os.environ['PATH']) try: - (fuse_proto, fuse_caps) = test_printcap() + (fuse_proto, fuse_caps) = get_printcap() except: # Rely on test to raise error fuse_proto = (0,0)