Tox 4.x: specify multiline lists in variables? (or expand them without the newline characters) #2922
-
IssueHi, Thanks a lot for writing, maintaining, and developing Tox! So I'm not sure that this is a bug report as such, since, as noted below, I fully understand why Tox does what it does and why. It's more of a "is there a way to configure Tox 4.x to do something similar to what I did in Tox 3.x" question. In short, I have something similar to the following setup in lots of my Tox 3.x tox.ini files (I added "skipsdist" for this pared-down example): [tox] envlist = mypy,pylint skipsdist = True [defs] pyfiles = src/confget src/some_other_tool_or_module unit_tests [testenv:mypy] deps = mypy >= 1, < 2 commands = mypy -- {[defs]pyfiles} [testenv:pylint] deps = pylint >= 2.16, < 2.17 commands = pylint -- {[defs]pyfiles} So this works with Tox 3.x: it expands the variable, apparently replaces the newline characters with spaces or something like that, and then runs the command on all the files. The same tox.ini syntax with Tox 4.x leads to Tox passing I mean, I understand why Tox 4.x would do that: after all, I did include some newline characters in the variable's value, so it wants to reflect that in the command. Still, is there a way to achieve what I want in Tox 4.x syntax? I know I can specify all the files on a single line, but I kind of like the readability of the one-per-line format... Thanks again, and keep up the great work! EnvironmentThis can be reproduced in a minimal virtual environment that only contains tox, e.g. one obtained by Package Version ------------- ------- cachetools 5.2.1 chardet 5.1.0 colorama 0.4.6 distlib 0.3.6 filelock 3.9.0 packaging 21.3 pip 22.3.1 platformdirs 2.6.2 pluggy 1.0.0 py 1.11.0 pyparsing 3.0.9 pyproject_api 1.2.1 six 1.16.0 toml 0.10.2 tomli 2.0.1 tox 4.1.0 virtualenv 20.17.1 ...and empty Output of running toxThis is the output of [nix-shell:~/lang/python/misc/tox-newlines]$ tox -r mypy: remove tox env folder /home/roam/lang/python/misc/tox-newlines/.tox/mypy mypy: install_deps> python -I -m pip install 'mypy<2,>=1' mypy: commands[0]> mypy -- src/confget Success: no issues found in 1 source file mypy: commands[1]> src/some_other_tool_or_module mypy: exit 2 (0.00 seconds) /home/roam/lang/python/misc/tox-newlines> src/some_other_tool_or_module mypy: FAIL ✖ in 2.16 seconds pylint: remove tox env folder /home/roam/lang/python/misc/tox-newlines/.tox/pylint pylint: install_deps> python -I -m pip install 'pylint<2.17,>=2.16' pylint: commands[0]> pylint -- src/confget pylint: commands[1]> src/some_other_tool_or_module pylint: exit 2 (0.00 seconds) /home/roam/lang/python/misc/tox-newlines> src/some_other_tool_or_module mypy: FAIL code 2 (2.16=setup[2.05]+cmd[0.10,0.00] seconds) pylint: FAIL code 2 (2.35=setup[1.97]+cmd[0.38,0.00] seconds) evaluation failed :( (4.54 seconds) [nix-shell:~/lang/python/misc/tox-newlines]$ Minimal exampleThis is the [roam@straylight ~/lang/python/misc/tox-newlines]$ cat > tox.ini <<EOINI [tox] envlist = mypy,pylint skipsdist = True [defs] pyfiles = src/confget src/some_other_tool_or_module unit_tests [testenv:mypy] deps = mypy >= 1, < 2 commands = mypy -- {[defs]pyfiles} [testenv:pylint] deps = pylint >= 2.16, < 2.17 commands = pylint -- {[defs]pyfiles} EOINI [roam@straylight ~/lang/python/misc/tox-newlines]$ mkdir -p src/confget src/some_other_tool_or_module unit_tests [roam@straylight ~/lang/python/misc/tox-newlines]$ touch src/confget/__init__.py src/some_other_tool_or_module/__init__.py unit_tests/__init__.py [roam@straylight ~/lang/python/misc/tox-newlines]$ |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Can't you [defs] pyfiles = src/confget \ src/some_other_tool_or_module \ unit_tests |
Beta Was this translation helpful? Give feedback.
Can't you
\
to specify the lines should be merged?