GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Race condition: collection error when directory is deleted before `scandir()` runs · Issue #13083 · pytest-dev/pytest

Race condition: collection error when directory is deleted before scandir() runs #13083

New issue
Copy link
New issue
Copy link
Closed
#13086
Closed
Race condition: collection error when directory is deleted before scandir() runs#13083
#13086
Copy link
Labels
good first issueeasy issue that is friendly to new contributortype: bugproblem that needs to be addressed

Description

@Zac-HD
Zac-HD
opened on Dec 24, 2024
Issue body actions

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:
    ...

Activity

  1. Zac-HD
    added
    type: bugproblem that needs to be addressed
    good first issueeasy issue that is friendly to new contributor
    on Dec 24, 2024
  2. delta87
    added a commit that references this issue on Dec 26, 2024

    Fix scandir() crash by returning [] when directory is not found (pyte…

    6156675
  3. nicoddemus
    added 3 commits that reference this issue on Jan 6, 2025

    Fix scandir() crash by returning [] when directory is not found (pyte…

    4840acb

    Fix scandir() crash by returning [] when directory is not found (pyte…

    15a1c95

    Fix crash when directory is removed during collection (#13086)

    3214263
  4. nicoddemus
    closed this as completedin #13086on Jan 8, 2025
  5. patchback
    added a commit that references this issue on Jan 8, 2025

    Fix crash when directory is removed during collection (#13086)

    This issue will close once commit db1c2b7 is merged into the 'main' branch.
    db1c2b7
  6. nicoddemus
    added a commit that references this issue on Jan 8, 2025

    Fix crash when directory is removed during collection (#13086) (#13117)

    This issue will close once commit f1c6bab is merged into the 'main' branch.
    f1c6bab
  7. luketainton
    added a commit that references this issue on Jan 5, 2026

    chore(deps): update dependency pytest to v9 (#305)

    4b75154
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueeasy issue that is friendly to new contributortype: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.