Skip to content

Commit

Permalink
Small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Zac-HD committed Mar 17, 2024
1 parent 2dd0fc8 commit 35b5e3d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
5 changes: 3 additions & 2 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
RELEASE_TYPE: minor
RELEASE_TYPE: patch

This release resolves :py:exc:`PermissionError` that come from creating databases on inaccessible paths.
This release resolves :py:exc:`PermissionError` that come from
creating databases on inaccessible paths.
5 changes: 2 additions & 3 deletions hypothesis-python/src/hypothesis/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ def _db_for_path(path=None):
stacklevel=3,
)
return InMemoryExampleDatabase()
return DirectoryBasedExampleDatabase(path)
if path in (None, ":memory:") or not _usable_dir(path):
if path in (None, ":memory:"):
return InMemoryExampleDatabase()
return DirectoryBasedExampleDatabase(path)

Expand Down Expand Up @@ -225,7 +224,7 @@ def fetch(self, key: bytes) -> Iterable[bytes]:
def save(self, key: bytes, value: bytes) -> None:
# Note: we attempt to create the dir in question now. We
# already checked for permissions, but there can still be other issues,
# e.g. the disk is full
# e.g. the disk is full, or permissions might have been changed.
self._key_path(key).mkdir(exist_ok=True, parents=True)
path = self._value_path(key, value)
if not path.exists():
Expand Down

0 comments on commit 35b5e3d

Please sign in to comment.