Skip to content

Commit 871aa27

Browse files
committed
drop a duplicate test and add a new one
1 parent b507210 commit 871aa27

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

tests/test_rwx.py

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,6 @@ def test_custom_writer_and_stream_reader():
9797
check_archive(archive, tree)
9898

9999

100-
def test_custom_writer_and_seekable_stream_reader():
101-
# Collect information on what should be in the archive
102-
tree = treestat('libarchive')
103-
104-
# Create an archive of our libarchive/ directory
105-
stream = io.BytesIO()
106-
with libarchive.custom_writer(stream.write, '7zip') as archive:
107-
archive.add_files('libarchive/')
108-
stream.seek(0)
109-
110-
# Read the archive and check that the data is correct
111-
with libarchive.seekable_stream_reader(stream, '7zip') as archive:
112-
paths = [entry.name.rstrip('/') for entry in archive]
113-
assert sorted(paths) == sorted(tree)
114-
115-
116100
@patch('libarchive.ffi.write_fail')
117101
def test_write_fail(write_fail_mock):
118102
buf = bytes(bytearray(1000000))
@@ -133,6 +117,14 @@ def test_write_not_fail(write_fail_mock):
133117
assert not write_fail_mock.called
134118

135119

120+
def test_adding_nonexistent_file_to_archive():
121+
stream = io.BytesIO()
122+
with libarchive.custom_writer(stream.write, 'zip') as archive:
123+
with pytest.raises(libarchive.ArchiveError):
124+
archive.add_files('nonexistent')
125+
archive.add_files('libarchive/')
126+
127+
136128
@pytest.mark.parametrize(
137129
'archfmt,data_bytes',
138130
[('zip', b'content'),

0 commit comments

Comments
 (0)