[feature-request] Support for "file|" syntax in set_env
piotr-kubiak opened this issue · comments
Piotr Kubiak commented
From https://tox.wiki/en/latest/config.html:
With my tox.ini
as:
[tox]
env_list = py311
[testenv:py311]
allowlist_externals = bash
set_env =
file|.env
commands =
bash -c 'env | grep "FOO"'
and .env
:
FOO=BAR
I get
$ tox
py311: commands[0]> bash -c "env | grep \"FOO\""
FOO=BAR
py311: OK (1.23=setup[0.14]+cmd[1.09] seconds)
congratulations :) (1.55 seconds)
Which is tottaly expected. However:
$ pre-commit run tox-ini-fmt
tox-ini-fmt..............................................................Failed
- hook id: tox-ini-fmt
- exit code: 1
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Scripts\tox-ini-fmt.EXE\__main__.py", line 7, in <module>
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Lib\site-packages\tox_ini_fmt\__main__.py", line 47, in run
formatted = format_tox_ini(before, opts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Lib\site-packages\tox_ini_fmt\formatter\__init__.py", line 34, in format_tox_ini
format_test_env(parser, section_name)
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Lib\site-packages\tox_ini_fmt\formatter\test_env.py", line 74, in format_test_env
fix_and_reorder(parser, name, tox_section_cfg, upgrade)
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Lib\site-packages\tox_ini_fmt\formatter\util.py", line 51, in fix_and_reorder
section[key] = fix(section[key])
^^^^^^^^^^^^^^^^^
File "C:\Users\xxx\.cache\pre-commit\reporcnyrb_x\py_env-python3\Lib\site-packages\tox_ini_fmt\formatter\test_env.py", line 107, in to_set_env
raise RuntimeError(msg)
RuntimeError: invalid line file|.env in setenv