Handles file locking issues on Windows
Addresses potential test failures on Windows due to locked files during temporary directory cleanup. Implements `ignore_errors=True` when removing temporary directories to prevent `shutil.rmtree` from failing when files are still locked by the process.
This commit is contained in:
1 file changed
+3
-1
+3
-1
@@ -16,7 +16,9 @@ def temp_dir():
|
|||||||
"""Create a temporary directory that is cleaned up after the test."""
|
"""Create a temporary directory that is cleaned up after the test."""
|
||||||
tmp = Path(tempfile.mkdtemp())
|
tmp = Path(tempfile.mkdtemp())
|
||||||
yield tmp
|
yield tmp
|
||||||
shutil.rmtree(tmp)
|
# On Windows, files may still be locked by the process
|
||||||
|
# Use ignore_errors to prevent test failures during cleanup
|
||||||
|
shutil.rmtree(tmp, ignore_errors=True)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|||||||
Reference in new issue
Block a user