-
- Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortype: bugproblem that needs to be addressedproblem that needs to be addressed
Description
Our scandir()
function crashes if the directory to scan does not exist, which can happen if e.g. a tempory directory is deleted during collection (as in HypothesisWorks/hypothesis#4200). I therefore propose catching the directory-not-found error and returning []
in this case:
try: with os.scandir(path) as s: scanned = list(s) except FileNotFoundError: return [] # Skip entries with symlink loops and other brokenness, so the caller # doesn't have to deal with it. for entry in scanned: ...
Metadata
Metadata
Assignees
Labels
good first issueeasy issue that is friendly to new contributoreasy issue that is friendly to new contributortype: bugproblem that needs to be addressedproblem that needs to be addressed