diff options
Diffstat (limited to 'tests/plugin/test_plugin.py')
-rw-r--r-- | tests/plugin/test_plugin.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/plugin/test_plugin.py b/tests/plugin/test_plugin.py index 78a24540..0d00602f 100644 --- a/tests/plugin/test_plugin.py +++ b/tests/plugin/test_plugin.py @@ -3,6 +3,7 @@ from __future__ import annotations import logging import os import sys +from pathlib import Path from typing import Any from unittest.mock import patch @@ -102,6 +103,33 @@ def test_plugin_hooks_and_order(tox_project: ToxProjectCreator, mocker: MockerFi assert result.out.splitlines() == expected, result.out +@pytest.mark.parametrize( + "dir_name", + [ + "tox_root", + "work_dir", + "temp_dir", + ], +) +def test_plugin_can_set_core_conf( + tox_project: ToxProjectCreator, + mocker: MockerFixture, + dir_name: str, + tmp_path: Path, +) -> None: + @impl + def tox_add_core_config(core_conf: CoreConfigSet, state: State) -> None: # noqa: U100 + core_conf.loaders.insert(0, MemoryLoader(**{dir_name: tmp_path})) + + register_inline_plugin(mocker, tox_add_core_config) + + project = tox_project({}) + result = project.run("c") + result.assert_success() + + assert result.state.conf.core[dir_name] == tmp_path + + def test_plugin_can_read_env_list(tox_project: ToxProjectCreator, mocker: MockerFixture) -> None: @impl def tox_add_core_config(core_conf: CoreConfigSet, state: State) -> None: # noqa: U100 |