Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PermissionError on inaccessible paths #3815

Closed
wants to merge 4 commits into from

Conversation

reaganjlee
Copy link
Contributor

Resolves part of #3764

I believe the error previous line suggestion wouldn't be reached since that's only when the path is not set, but correct me if I'm wrong.

Also noticed that some of the other databases can have inaccessible paths as well, or I can't find the checks that this comment is refers to. Added one of these database types into the test, but let me know what the desired behavior on this is

@@ -69,7 +69,7 @@ def _db_for_path(path=None):
stacklevel=3,
)
return InMemoryExampleDatabase()
if path in (None, ":memory:"):
if path in (None, ":memory:") or not os.access(path, os.R_OK | os.W_OK | os.X_OK):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong because the path may not exist yet.

The difficulty is that we don't want to create it before we actually need to write something either, both for performance reasons and to avoid annoying people who have Hypothesis installed but aren't using it.

@reaganjlee
Copy link
Contributor Author

This looks like it would need more back-and-forth with the CI than ideal. I'll focus on some other issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants