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

race condition between creation of .pytest_cache and .pytest_cache/.gitignore #12167

Closed
tamird opened this issue Mar 29, 2024 · 0 comments · Fixed by #12168
Closed

race condition between creation of .pytest_cache and .pytest_cache/.gitignore #12167

tamird opened this issue Mar 29, 2024 · 0 comments · Fixed by #12168

Comments

@tamird
Copy link
Contributor

tamird commented Mar 29, 2024

The solution implemented in #3982 is not robust - in case test execution is interrupted while a cache element is being written, the .pytest_cache directory will exist and be non-empty, but will not contain .gitignore.

Because of this check .gitignore ends up never being created.

tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 29, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Use json.dump instead of json.dumps + write for a tiny perf win.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 31, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 31, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 31, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Mar 31, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Writing cache data is interruptible; this prevents a pathological case
where interrupting a cache write can cause the cache directory to never
be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Fixes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Writing cache data is interruptible; this reduces the probability of a
pathological case where interrupting a cache write can cause the cache
directory to never be properly initialized with its supporting files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 1, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 2, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 2, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 2, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 3, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 3, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 3, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
tamird added a commit to tamird/pytest that referenced this issue Apr 3, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
flying-sheep pushed a commit to flying-sheep/pytest that referenced this issue Apr 9, 2024
Creating and initializing the cache directory is interruptible; this
avoids a pathological case where interrupting a cache write can cause
the cache directory to never be properly initialized with its supporting
files.

Unify `Cache.mkdir` with `Cache.set` while I'm here so the former also
properly initializes the cache directory.

Closes pytest-dev#12167.
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 a pull request may close this issue.

1 participant