diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2019-07-04 21:20:41 +0100 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2019-07-04 21:20:41 +0100 |
commit | 1343f59c274bd5c4cea3ed5ca3dea092000f2b13 (patch) | |
tree | 89bbf129979d6918a72019321e2676cf979b3cdb /test/test_ctests.py | |
parent | be8db96603631ea85bb82a39c77a5514cbc47348 (diff) | |
download | libfuse-1343f59c274bd5c4cea3ed5ca3dea092000f2b13.tar.gz |
Fix output checking in test cases
py.test's capture plugin does not work reliably when used by
other fixtures. Therefore, implement our own version.
Diffstat (limited to 'test/test_ctests.py')
-rw-r--r-- | test/test_ctests.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test_ctests.py b/test/test_ctests.py index d2f8582..e4ce668 100644 --- a/test/test_ctests.py +++ b/test/test_ctests.py @@ -21,7 +21,7 @@ pytestmark = fuse_test_marker() @pytest.mark.skipif('FUSE_CAP_WRITEBACK_CACHE' not in fuse_caps, reason='not supported by running kernel') @pytest.mark.parametrize("writeback", (False, True)) -def test_write_cache(tmpdir, writeback): +def test_write_cache(tmpdir, writeback, output_checker): if writeback and LooseVersion(platform.release()) < '3.14': pytest.skip('Requires kernel 3.14 or newer') # This test hangs under Valgrind when running close(fd) @@ -33,7 +33,7 @@ def test_write_cache(tmpdir, writeback): mnt_dir ] if writeback: cmdline.append('-owriteback_cache') - subprocess.check_call(cmdline) + subprocess.check_call(cmdline, stdout=output_checker.fd, stderr=output_checker.fd) names = [ 'notify_inval_inode', 'invalidate_path' ] @@ -43,14 +43,15 @@ if fuse_proto >= (7,15): reason='not supported by running kernel') @pytest.mark.parametrize("name", names) @pytest.mark.parametrize("notify", (True, False)) -def test_notify1(tmpdir, name, notify): +def test_notify1(tmpdir, name, notify, output_checker): mnt_dir = str(tmpdir) cmdline = base_cmdline + \ [ pjoin(basename, 'example', name), '-f', '--update-interval=1', mnt_dir ] if not notify: cmdline.append('--no-notify') - mount_process = subprocess.Popen(cmdline) + mount_process = subprocess.Popen(cmdline, stdout=output_checker.fd, + stderr=output_checker.fd) try: wait_for_mount(mount_process, mnt_dir) filename = pjoin(mnt_dir, 'current_time') @@ -72,14 +73,15 @@ def test_notify1(tmpdir, name, notify): @pytest.mark.skipif(fuse_proto < (7,12), reason='not supported by running kernel') @pytest.mark.parametrize("notify", (True, False)) -def test_notify_file_size(tmpdir, notify): +def test_notify_file_size(tmpdir, notify, output_checker): mnt_dir = str(tmpdir) cmdline = base_cmdline + \ [ pjoin(basename, 'example', 'invalidate_path'), '-f', '--update-interval=1', mnt_dir ] if not notify: cmdline.append('--no-notify') - mount_process = subprocess.Popen(cmdline) + mount_process = subprocess.Popen(cmdline, stdout=output_checker.fd, + stderr=output_checker.fd) try: wait_for_mount(mount_process, mnt_dir) filename = pjoin(mnt_dir, 'growing') |