Skip to content

Commit

Permalink
create parent dir in _deliver_to_file
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug committed Jan 8, 2024
1 parent 6da7c6f commit b7bd2b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions hypothesis-python/RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
RELEASE_TYPE: patch

This patch fixes an error when writing :doc:`observability <observability>` reports without a pre-existing ``.hypothesis`` directory.
2 changes: 1 addition & 1 deletion hypothesis-python/src/hypothesis/internal/observability.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def make_testcase(
def _deliver_to_file(value): # pragma: no cover
kind = "testcases" if value["type"] == "test_case" else "info"
fname = storage_directory("observed", f"{date.today().isoformat()}_{kind}.jsonl")
fname.parent.mkdir(exist_ok=True)
fname.parent.mkdir(exist_ok=True, parents=True)
_WROTE_TO.add(fname)
with fname.open(mode="a") as f:
f.write(json.dumps(value) + "\n")
Expand Down

0 comments on commit b7bd2b5

Please sign in to comment.