Skip to content

Commit b6feaca

Browse files
committed
Get environments from tox.ini
1 parent 684631a commit b6feaca

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/try_parser.py

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
from tox.config.source.ini import IniSource
22
from tox.config.types import EnvList
33
from pathlib import Path
4-
from ipdb import set_trace
54
from tox.config.cli.parse import get_options
65
from tox.session.state import State
6+
from tox.config.sets import CoreConfigSet
7+
from tox.config.source.tox_ini import ToxIni
8+
from collections import defaultdict
9+
from json import dumps
10+
11+
tox_ini_path = Path(
12+
"/home/tigre/github/ocelotl/opentelemetry-python-contrib/tox.ini"
13+
)
714

815
ini_source = IniSource(
916
Path("/home/tigre/github/ocelotl/opentelemetry-python-contrib/tox.ini")
1017
)
1118

19+
tox_ini = ToxIni(tox_ini_path)
20+
1221
state = State(get_options(), [])
1322

1423
conf = state.conf
15-
set_trace()
1624

1725
tox_section = [section for section in ini_source.sections()][0]
1826

@@ -23,4 +31,12 @@
2331

2432
raw = tox_section_loader.load_raw("envlist", conf, None)
2533

26-
set_trace()
34+
core_config_set = CoreConfigSet(conf, tox_section, tox_ini_path.parent, tox_ini_path)
35+
36+
loaders = tox_ini.get_loaders(tox_section, base=[], override_map=defaultdict(list, {}), conf=core_config_set)
37+
38+
core_config_set.loaders.extend(loaders)
39+
40+
result = core_config_set.load("env_list")
41+
42+
print(dumps(result.envs, indent=4))

0 commit comments

Comments
 (0)