From cb6da126941fb329a4817f061d30fe21eb3fa7a8 Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Wed, 24 May 2017 16:20:04 -0700 Subject: Added tst_open_read() Slightly increases coverage of examples/passthrough_ll.c (which supports open for reading, but not for writing). --- test/test_examples.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') diff --git a/test/test_examples.py b/test/test_examples.py index d508d0f..9ba3ffe 100755 --- a/test/test_examples.py +++ b/test/test_examples.py @@ -86,6 +86,7 @@ def test_passthrough(tmpdir, name, debug, capfd): tst_statvfs(work_dir) tst_readdir(src_dir, work_dir) + tst_open_read(src_dir, work_dir) if not is_ll: tst_mkdir(work_dir) tst_rmdir(src_dir, work_dir) @@ -371,6 +372,14 @@ def tst_chown(mnt_dir): assert fstat.st_uid == uid_new assert fstat.st_gid == gid_new +def tst_open_read(src_dir, mnt_dir): + name = name_generator() + with open(pjoin(src_dir, name), 'wb') as fh_out, \ + open(TEST_FILE, 'rb') as fh_in: + shutil.copyfileobj(fh_in, fh_out) + + assert filecmp.cmp(pjoin(mnt_dir, name), TEST_FILE, False) + def tst_open_write(src_dir, mnt_dir): name = name_generator() fd = os.open(pjoin(src_dir, name), -- cgit v1.2.3