From 6ce27f48bc6bb797c4d3953572e00e9579f0af87 Mon Sep 17 00:00:00 2001 From: Matthias Goergens Date: Fri, 7 Apr 2023 15:39:21 +0800 Subject: 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( ``` --- test/util.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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) -- cgit v1.2.1