From c8a816c7bec2ab5593cb5b9915d5f0af51d64f41 Mon Sep 17 00:00:00 2001 From: Arun Babu Neelicattu Date: Thu, 28 Apr 2022 03:11:20 +0200 Subject: [PATCH] tests: use safe_rmtree instead of custom logic --- tests/conftest.py | 3 ++- tests/integration/test_utils_vcs_git.py | 15 --------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b4664b340aa..093289522b2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -30,6 +30,7 @@ from poetry.utils.env import EnvManager from poetry.utils.env import SystemEnv from poetry.utils.env import VirtualEnv +from poetry.utils.helpers import safe_rmtree from tests.helpers import TestLocker from tests.helpers import TestRepository from tests.helpers import get_package @@ -306,7 +307,7 @@ def tmp_dir() -> Iterator[str]: yield dir_ - shutil.rmtree(dir_) + safe_rmtree(dir_) @pytest.fixture diff --git a/tests/integration/test_utils_vcs_git.py b/tests/integration/test_utils_vcs_git.py index 906ae157d5f..7989d1ea990 100644 --- a/tests/integration/test_utils_vcs_git.py +++ b/tests/integration/test_utils_vcs_git.py @@ -1,13 +1,11 @@ from __future__ import annotations -import stat import uuid from copy import deepcopy from hashlib import sha1 from pathlib import Path from typing import TYPE_CHECKING -from typing import Iterator import pytest @@ -17,7 +15,6 @@ from poetry.core.pyproject.toml import PyProjectTOML from poetry.console.exceptions import PoetrySimpleConsoleException -from poetry.utils._compat import WINDOWS from poetry.vcs.git import Git from poetry.vcs.git.backend import GitRefSpec @@ -62,18 +59,6 @@ def setup(config: Config) -> None: } -@pytest.fixture(autouse=WINDOWS) -def cleanup_set_readonly_permissions_windows(tmp_dir: str) -> Iterator[None]: - """ - Ensure all read-only files created by git are set to writable - """ - yield - - for path in Path(tmp_dir).glob("**/.git/**/*"): - if path.is_file(): - path.chmod(mode=stat.S_IWRITE) - - @pytest.fixture def use_system_git_client(config: Config) -> None: config.merge({"experimental": {"system-git-client": True}})