Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature-request] Support for "file|" syntax in set_env #199

Open
piotr-kubiak opened this issue Mar 27, 2024 · 0 comments
Open

[feature-request] Support for "file|" syntax in set_env #199

piotr-kubiak opened this issue Mar 27, 2024 · 0 comments

Comments

@piotr-kubiak
Copy link

From https://tox.wiki/en/latest/config.html:

image

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant