Skip to content

Commit 4ec2bf5

Browse files
committed
Added set_env 'file' option in TOML as dict
1 parent 9d1f105 commit 4ec2bf5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/tox/config/set_env.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
class SetEnv:
14-
def __init__( # noqa: C901
14+
def __init__( # noqa: C901, PLR0912
1515
self, raw: str | dict[str, str] | list[dict[str, str]], name: str, env_name: str | None, root: Path
1616
) -> None:
1717
self.changed = False
@@ -24,13 +24,21 @@ def __init__( # noqa: C901
2424
from .loader.replacer import MatchExpression, find_replace_expr # noqa: PLC0415
2525

2626
if isinstance(raw, dict):
27-
self._raw = raw
27+
# TOML 'file' attribute is to be handled separately later
28+
self._raw = dict(raw)
29+
if "file" in raw:
30+
self._env_files.append(raw["file"])
31+
self._raw.pop("file")
32+
2833
return
34+
2935
if isinstance(raw, list):
3036
self._raw = reduce(lambda a, b: {**a, **b}, raw)
3137
return
38+
3239
for line in raw.splitlines(): # noqa: PLR1702
3340
if line.strip():
41+
# INI 'file|' attribute is to be handled separately later
3442
if line.startswith("file|"):
3543
self._env_files.append(line[len("file|") :])
3644
else:

0 commit comments

Comments
 (0)