Skip to content

Commit

Permalink
tests: ensure ephemeral config usage
Browse files Browse the repository at this point in the history
Previously, pytest execution was influenced by poetry user
configuration. This change ensures that a new config.toml is used each
test case.
  • Loading branch information
abn committed Apr 28, 2021
1 parent 1811374 commit ce9ced2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ce9ced2

Please sign in to comment.