diff --git a/tests/conftest.py b/tests/conftest.py index 9481c31457b..d66ed9ba659 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -99,6 +99,15 @@ def config(config_source, auth_config_source, mocker): return c +@pytest.fixture(autouse=True) +def mock_user_config_dir(mocker): + config_dir = tempfile.mkdtemp(prefix="poetry_config_") + mocker.patch("poetry.locations.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) def download_mock(mocker): # Patch download to not download anything but to just copy from fixtures