Skip to content

Commit

Permalink
Support list to EnvList conversion in MemoryLoader (tox-dev#3343)
Browse files Browse the repository at this point in the history
  • Loading branch information
ziima committed Sep 15, 2024
1 parent e87204b commit d575c8b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/tox/config/loader/memory.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterator
from typing import TYPE_CHECKING, Any, Iterator, Sequence

from tox.config.types import Command, EnvList

Expand Down Expand Up @@ -62,4 +62,6 @@ def to_env_list(value: Any) -> EnvList:
return value
if isinstance(value, str):
return StrConvert.to_env_list(value)
if isinstance(value, Sequence):
return EnvList(value)
raise TypeError(value)
1 change: 1 addition & 0 deletions tests/config/loader/test_memory_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def test_memory_loader_override() -> None:
(os.getcwd(), Path, Path.cwd()), # noqa: PTH109
("pip list", Command, Command(["pip", "list"])),
("a\nb", EnvList, EnvList(["a", "b"])),
(["a", "b"], EnvList, EnvList(["a", "b"])),
("1", Optional[int], 1),
],
)
Expand Down

0 comments on commit d575c8b

Please sign in to comment.