| 22 | @pytest.fixture |
| 23 | def replace_one(tmp_path: Path) -> ReplaceOne: |
| 24 | def example(conf: str, pos_args: list[str] | None = None) -> str: |
| 25 | tox_ini_file = tmp_path / "tox.ini" |
| 26 | tox_ini_file.write_text(f"[testenv:py]\nenv={conf}\n") |
| 27 | tox_ini = ToxIni(tox_ini_file) |
| 28 | |
| 29 | config = Config( |
| 30 | tox_ini, |
| 31 | options=Parsed(override=[]), |
| 32 | root=tmp_path, |
| 33 | pos_args=pos_args, |
| 34 | work_dir=tmp_path, |
| 35 | extra_envs=(), |
| 36 | ) |
| 37 | loader = config.get_env("py").loaders[0] |
| 38 | args = ConfigLoadArgs(chain=[], name="a", env_name="a") |
| 39 | return loader.load(key="env", of_type=str, conf=config, factory=None, args=args) |
| 40 | |
| 41 | return example |