Commit a514831e by Arun Babu Neelicattu

tests: ensure mocked config reuses global temp dir

This ensures clean up is consistent.
parent 0e5f953e
...@@ -190,13 +190,15 @@ def config( ...@@ -190,13 +190,15 @@ def config(
return c return c
@pytest.fixture()
def config_dir(tmp_dir: str) -> str:
return tempfile.mkdtemp(prefix="poetry_config_", dir=tmp_dir)
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def mock_user_config_dir(mocker: MockerFixture) -> Iterator[None]: def mock_user_config_dir(mocker: MockerFixture, config_dir: str) -> None:
config_dir = tempfile.mkdtemp(prefix="poetry_config_")
mocker.patch("poetry.locations.CONFIG_DIR", new=config_dir) mocker.patch("poetry.locations.CONFIG_DIR", new=config_dir)
mocker.patch("poetry.factory.CONFIG_DIR", new=config_dir) mocker.patch("poetry.factory.CONFIG_DIR", new=config_dir)
yield
shutil.rmtree(config_dir, ignore_errors=True)
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment