Skip to content

Commit

Permalink
fix Schrödinger memory resource (#229)
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan authored Nov 10, 2018
1 parent 05ac13e commit 8c280c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion fs/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Version, used in module and setup.py.
"""
__version__ = "2.1.1"
__version__ = "2.1.2a0"
3 changes: 3 additions & 0 deletions fs/memoryfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ def openbin(self, path, mode="r", buffering=-1, **options):
_path = self.validatepath(path)
dir_path, file_name = split(_path)

if not file_name:
raise errors.FileExpected(path)

with self._lock:
parent_dir_entry = self._get_dir_entry(dir_path)
if parent_dir_entry is None or not parent_dir_entry.is_dir:
Expand Down
6 changes: 6 additions & 0 deletions fs/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,12 @@ def assert_text(self, path, contents):
self.assertEqual(data, contents)
self.assertIsInstance(data, text_type)

def test_root_dir(self):
with self.assertRaises(errors.FileExpected):
self.fs.open("/")
with self.assertRaises(errors.FileExpected):
self.fs.openbin("/")

def test_appendbytes(self):
with self.assertRaises(TypeError):
self.fs.appendbytes("foo", "bar")
Expand Down

0 comments on commit 8c280c2

Please sign in to comment.