Skip to content

Commit

Permalink
handle race condition on teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeitsperre committed Nov 13, 2024
1 parent 9e4e6b5 commit bb3cc81
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# noqa: D104
from __future__ import annotations

import logging
import os
from functools import partial
from pathlib import Path
Expand Down Expand Up @@ -411,6 +412,12 @@ def remove_data_written_flag():
"""Cleanup cache folder once we are finished."""
flag = default_testdata_cache.joinpath(".data_written")
if flag.exists():
flag.unlink()
try:
flag.unlink()
except FileNotFoundError:
logging.info(
"Teardown race condition occurred: .data_written flag already removed. Lucky!"
)
pass

request.addfinalizer(remove_data_written_flag)

0 comments on commit bb3cc81

Please sign in to comment.