Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,10 @@ def upload(self, path, file, chunk_size=None, **options):
sensible default.
**options: Implementation specific options required to open
the source file.

Raises:
fs.errors.ResourceNotFound: If a parent directory of
``path`` does not exist.

Note that the file object ``file`` will *not* be closed by this
method. Take care to close it after this method completes
Expand Down
4 changes: 4 additions & 0 deletions fs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,10 @@ def test_upload(self):
with self.fs.open("foo", "rb") as f:
data = f.read()
self.assertEqual(data, b"bar")

# upload to non-existing path (/foo/bar)
with self.assertRaises(errors.ResourceNotFound):
self.fs.upload("/foo/bar/baz", bytes_file)

def test_upload_chunk_size(self):
test_data = b"bar" * 128
Expand Down