|
1 | 1 | from __future__ import annotations
|
2 | 2 |
|
3 | 3 | import os
|
| 4 | +from functools import partial |
4 | 5 | from pathlib import Path
|
5 | 6 | from typing import TYPE_CHECKING, List
|
6 | 7 |
|
|
9 | 10 | from tox.config.loader.api import Override
|
10 | 11 | from tox.config.loader.memory import MemoryLoader
|
11 | 12 | from tox.config.sets import ConfigSet
|
| 13 | +from tox.tox_env.python.pip.req_file import PythonDeps |
12 | 14 |
|
13 | 15 | if TYPE_CHECKING:
|
14 | 16 | from tests.conftest import ToxIniCreator
|
@@ -98,6 +100,37 @@ def test_config_override_appends_to_empty_setenv(tox_ini_conf: ToxIniCreator) ->
|
98 | 100 | assert conf["setenv"].load("foo") == "bar"
|
99 | 101 |
|
100 | 102 |
|
| 103 | +def test_config_override_appends_to_pythondeps(tox_ini_conf: ToxIniCreator, tmp_path: Path) -> None: |
| 104 | + example = """ |
| 105 | + [testenv] |
| 106 | + deps = foo |
| 107 | + """ |
| 108 | + conf = tox_ini_conf(example, override=[Override("testenv.deps+=bar")]).get_env("testenv") |
| 109 | + conf.add_config( |
| 110 | + "deps", |
| 111 | + of_type=PythonDeps, |
| 112 | + factory=partial(PythonDeps.factory, tmp_path), |
| 113 | + default=PythonDeps("", root=tmp_path), |
| 114 | + desc="desc", |
| 115 | + ) |
| 116 | + assert conf["deps"].lines() == ["foo", "bar"] |
| 117 | + |
| 118 | + |
| 119 | +def test_config_override_appends_to_empty_pythondeps(tox_ini_conf: ToxIniCreator, tmp_path: Path) -> None: |
| 120 | + example = """ |
| 121 | + [testenv] |
| 122 | + """ |
| 123 | + conf = tox_ini_conf(example, override=[Override("testenv.deps+=bar")]).get_env("testenv") |
| 124 | + conf.add_config( |
| 125 | + "deps", |
| 126 | + of_type=PythonDeps, |
| 127 | + factory=partial(PythonDeps.factory, tmp_path), |
| 128 | + default=PythonDeps("", root=tmp_path), |
| 129 | + desc="desc", |
| 130 | + ) |
| 131 | + assert conf["deps"].lines() == ["bar"] |
| 132 | + |
| 133 | + |
101 | 134 | def test_config_override_cannot_append(tox_ini_conf: ToxIniCreator) -> None:
|
102 | 135 | example = """
|
103 | 136 | [testenv]
|
|
0 commit comments