tox-dev / tox

Command line driven CI frontend and development task automation tool.
https://tox.wiki
MIT License
3.68k stars 522 forks source link

factor-specific commands broken with multiline #2912

Open masenf opened 1 year ago

masenf commented 1 year ago

Issue

Additional lines of a factor-specific multiline command are not removed when the factor is not present.

Environment

Provide at least:

./.tox/.tox/bin/pip list
Package       Version
------------- -------
cachetools    5.3.0
chardet       5.1.0
colorama      0.4.6
distlib       0.3.6
filelock      3.9.0
packaging     23.0
pip           22.3.1
platformdirs  2.6.2
pluggy        1.0.0
pyproject_api 1.5.0
setuptools    65.6.3
tomli         2.0.1
tox           4.4.4
virtualenv    20.17.1
wheel         0.38.4

Output of running tox

foo: commands[0]> python -c 'print('"'"'foo'"'"')'
foo
foo: commands[1]> python -c 'print('"'"'bar'"'"')'
bar
foo: OK ✔ in 2.26 seconds
bar: commands[0]> 'print('"'"'foo'"'"')"'
bar: exit 2 (0.01 seconds) /git/repro/tox-list-label> 'print('"'"'foo'"'"')"'
  foo: OK (2.26=setup[2.06]+cmd[0.12,0.08] seconds)
  bar: FAIL code 2 (1.46=setup[1.45]+cmd[0.01] seconds)
  evaluation failed :( (4.85 seconds)

☝️ Notice how the continuation line from the foo: specific command was executed in bar's environment. Would have expected the bar environment to only execute python -c "print('bar')"

Provide the output of `tox -rvv`: ```console ROOT: 1319 W will run in automatically provisioned tox, host /home/mfurer/.pytools/bin/python is missing [requires (has)]: tox>=4.4.4 (4.4.3) [tox/provision.py:125] ROOT: 1381 I find interpreter for spec PythonSpec(path=/home/mfurer/.pytools/bin/python) [virtualenv/discovery/builtin.py:56] ROOT: 1381 D discover exe for PythonInfo(spec=CPython3.8.10.final.0-64, exe=/home/mfurer/.pytools/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) in /usr [virtualenv/discovery/py_info.py:437] ROOT: 1383 D filesystem is case-sensitive [virtualenv/info.py:24] ROOT: 1386 D got python info of /usr/bin/python3.8 from /home/mfurer/.local/share/virtualenv/py_info/1/df0893f56f349688326838aaeea0de204df53a132722cbd565e54b24a8fec5f6.json [virtualenv/app_data/via_disk_folder.py:129] ROOT: 1980 I proposed PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/home/mfurer/.pytools/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63] ROOT: 1980 D accepted PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/home/mfurer/.pytools/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65] ROOT: 2029 I will run in a automatically provisioned python environment under /git/repro/tox-list-label/.tox/.tox/bin/python [tox/provision.py:146] ROOT: 2040 I create virtual environment via CPython3Posix(dest=/git/repro/tox-list-label/.tox/.tox, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:48] ROOT: 2040 D create folder /git/repro/tox-list-label/.tox/.tox/bin [virtualenv/util/path/_sync.py:9] ROOT: 2041 D create folder /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:9] ROOT: 2041 D write /git/repro/tox-list-label/.tox/.tox/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] ROOT: 2041 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] ROOT: 2041 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] ROOT: 2042 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] ROOT: 2045 D symlink /usr/bin/python3.8 to /git/repro/tox-list-label/.tox/.tox/bin/python [virtualenv/util/path/_sync.py:28] ROOT: 2047 D create virtualenv import hook file /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:89] ROOT: 2047 D create /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:92] ROOT: 2049 D ============================== target debug ============================== [virtualenv/run/session.py:50] ROOT: 2049 D debug via /git/repro/tox-list-label/.tox/.tox/bin/python /home/mfurer/.pytools/lib/python3.8/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:197] ROOT: 2049 D { "sys": { "executable": "/git/repro/tox-list-label/.tox/.tox/bin/python", "_base_executable": "/git/repro/tox-list-label/.tox/.tox/bin/python", "prefix": "/git/repro/tox-list-label/.tox/.tox", "base_prefix": "/usr", "real_prefix": null, "exec_prefix": "/git/repro/tox-list-label/.tox/.tox", "base_exec_prefix": "/usr", "path": [ "/usr/lib/python38.zip", "/usr/lib/python3.8", "/usr/lib/python3.8/lib-dynload", "/git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages" ], "meta_path": [ "", "", "", "" ], "fs_encoding": "utf-8", "io_encoding": "utf-8" }, "version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]", "makefile_filename": "/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile", "os": "", "site": "", "datetime": "", "math": "", "json": "" } [virtualenv/run/session.py:51] ROOT: 2119 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mfurer/.local/share/virtualenv) [virtualenv/run/session.py:55] ROOT: 2124 D got embed update of distribution wheel from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/wheel.json [virtualenv/app_data/via_disk_folder.py:129] ROOT: 2128 D got embed update of distribution pip from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/pip.json [virtualenv/app_data/via_disk_folder.py:129] ROOT: 2129 D got embed update of distribution setuptools from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/setuptools.json [virtualenv/app_data/via_disk_folder.py:129] ROOT: 2132 D install wheel from wheel /home/mfurer/.pytools/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.38.4-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] ROOT: 2132 D install pip from wheel /home/mfurer/.pytools/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.3.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] ROOT: 2133 D install setuptools from wheel /home/mfurer/.pytools/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-65.6.3-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] ROOT: 2135 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.dist-info to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/wheel-0.38.4.dist-info [virtualenv/util/path/_sync.py:36] ROOT: 2136 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.virtualenv to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/pip-22.3.1.virtualenv [virtualenv/util/path/_sync.py:36] ROOT: 2137 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.dist-info to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/pip-22.3.1.dist-info [virtualenv/util/path/_sync.py:36] ROOT: 2142 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/distutils-precedence.pth to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:36] ROOT: 2144 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/pkg_resources to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:36] ROOT: 2157 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.virtualenv to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/wheel-0.38.4.virtualenv [virtualenv/util/path/_sync.py:36] ROOT: 2159 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:36] ROOT: 2161 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:36] ROOT: 2258 D generated console scripts wheel wheel-3.8 wheel3 wheel3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] ROOT: 2328 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/_distutils_hack to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:36] ROOT: 2334 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:36] ROOT: 2748 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.virtualenv to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/setuptools-65.6.3.virtualenv [virtualenv/util/path/_sync.py:36] ROOT: 2750 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.dist-info to /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/setuptools-65.6.3.dist-info [virtualenv/util/path/_sync.py:36] ROOT: 2771 D generated console scripts [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] ROOT: 3283 D generated console scripts pip3.8 pip3 pip pip-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] ROOT: 3283 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:61] ROOT: 3291 D write /git/repro/tox-list-label/.tox/.tox/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] ROOT: 3291 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] ROOT: 3291 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] ROOT: 3291 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] ROOT: 3291 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] ROOT: 3291 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] ROOT: 3292 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] ROOT: 3292 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] ROOT: 3292 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] ROOT: 3317 W install_deps> python -I -m pip install 'tox>=4.4.4' [tox/tox_env/api.py:427] Looking in indexes: https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/simple Collecting tox>=4.4.4 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/93/93/5d1bef67a06f257cfe9f97cc30bee27f1e11c917907eacbabd8cd1e789bc/tox-4.4.4-py3-none-any.whl (148 kB) Collecting pyproject-api>=1.5 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/25/8d/261289ccd17044fb1fdf99da1ece3fda631b61b53b3c49f02e21f3e8af00/pyproject_api-1.5.0-py3-none-any.whl (12 kB) Collecting virtualenv>=20.17.1 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/18/a2/7931d40ecb02b5236a34ac53770f2f6931e3082b7a7dafe915d892d749d6/virtualenv-20.17.1-py3-none-any.whl (8.8 MB) Collecting filelock>=3.9 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/14/4c/b201d0292ca4e0950f0741212935eac9996f69cd66b92a3587e594999163/filelock-3.9.0-py3-none-any.whl (9.7 kB) Collecting colorama>=0.4.6 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl (25 kB) Collecting tomli>=2.0.1 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/97/75/10a9ebee3fd790d20926a90a2547f0bf78f371b2f13aa822c759680ca7b9/tomli-2.0.1-py3-none-any.whl (12 kB) Collecting packaging>=23 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/ed/35/a31aed2993e398f6b09a790a181a7927eb14610ee8bbf02dc14d31677f1c/packaging-23.0-py3-none-any.whl (42 kB) Collecting chardet>=5.1 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/74/8f/8fc49109009e8d2169d94d72e6b1f4cd45c13d147ba7d6170fb41f22b08f/chardet-5.1.0-py3-none-any.whl (199 kB) Collecting pluggy>=1 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/9e/01/f38e2ff29715251cf25532b9082a1589ab7e4f571ced434f98d0139336dc/pluggy-1.0.0-py2.py3-none-any.whl (13 kB) Collecting platformdirs>=2.6.2 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/c1/c7/9be9d651b93efce682b45142a6267034fc4215972780748618c02e236361/platformdirs-2.6.2-py3-none-any.whl (14 kB) Collecting cachetools>=5.2.1 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/db/14/2b48a834d349eee94677e8702ea2ef98b7c674b090153ea8d3f6a788584e/cachetools-5.3.0-py3-none-any.whl (9.3 kB) Collecting distlib<1,>=0.3.6 Using cached https://artifactory-ha.west.isilon.com/artifactory/api/pypi/pypi-repo/packages/packages/76/cb/6bbd2b10170ed991cf64e8c8b85e01f2fb38f95d1bc77617569e0b0b26ac/distlib-0.3.6-py2.py3-none-any.whl (468 kB) Installing collected packages: distlib, tomli, pluggy, platformdirs, packaging, filelock, colorama, chardet, cachetools, virtualenv, pyproject-api, tox Successfully installed cachetools-5.3.0 chardet-5.1.0 colorama-0.4.6 distlib-0.3.6 filelock-3.9.0 packaging-23.0 platformdirs-2.6.2 pluggy-1.0.0 pyproject-api-1.5.0 tomli-2.0.1 tox-4.4.4 virtualenv-20.17.1 ROOT: 14450 I exit 0 (11.13 seconds) /git/repro/tox-list-label> python -I -m pip install 'tox>=4.4.4' pid=3596846 [tox/execute/api.py:275] ROOT: 14453 W provision> .tox/.tox/bin/python -m tox -rvv [tox/tox_env/api.py:427] foo: 1277 I find interpreter for spec PythonSpec(path=/git/repro/tox-list-label/.tox/.tox/bin/python) [virtualenv/discovery/builtin.py:56] foo: 1278 D discover exe for PythonInfo(spec=CPython3.8.10.final.0-64, exe=/git/repro/tox-list-label/.tox/.tox/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) in /usr [virtualenv/discovery/py_info.py:437] foo: 1279 D filesystem is case-sensitive [virtualenv/info.py:24] foo: 1281 D got python info of /usr/bin/python3.8 from /home/mfurer/.local/share/virtualenv/py_info/1/df0893f56f349688326838aaeea0de204df53a132722cbd565e54b24a8fec5f6.json [virtualenv/app_data/via_disk_folder.py:129] foo: 1327 I proposed PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/git/repro/tox-list-label/.tox/.tox/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63] foo: 1328 D accepted PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/git/repro/tox-list-label/.tox/.tox/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65] foo: 1386 I create virtual environment via CPython3Posix(dest=/git/repro/tox-list-label/.tox/foo, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:48] foo: 1386 D create folder /git/repro/tox-list-label/.tox/foo/bin [virtualenv/util/path/_sync.py:9] foo: 1387 D create folder /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:9] foo: 1387 D write /git/repro/tox-list-label/.tox/foo/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] foo: 1387 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] foo: 1388 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] foo: 1389 D symlink /usr/bin/python3.8 to /git/repro/tox-list-label/.tox/foo/bin/python [virtualenv/util/path/_sync.py:28] foo: 1392 D create virtualenv import hook file /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:89] foo: 1394 D create /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:92] foo: 1396 D ============================== target debug ============================== [virtualenv/run/session.py:50] foo: 1397 D debug via /git/repro/tox-list-label/.tox/foo/bin/python /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:197] foo: 1396 D { "sys": { "executable": "/git/repro/tox-list-label/.tox/foo/bin/python", "_base_executable": "/git/repro/tox-list-label/.tox/foo/bin/python", "prefix": "/git/repro/tox-list-label/.tox/foo", "base_prefix": "/usr", "real_prefix": null, "exec_prefix": "/git/repro/tox-list-label/.tox/foo", "base_exec_prefix": "/usr", "path": [ "/usr/lib/python38.zip", "/usr/lib/python3.8", "/usr/lib/python3.8/lib-dynload", "/git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages" ], "meta_path": [ "", "", "", "" ], "fs_encoding": "utf-8", "io_encoding": "utf-8" }, "version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]", "makefile_filename": "/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile", "os": "", "site": "", "datetime": "", "math": "", "json": "" } [virtualenv/run/session.py:51] foo: 1466 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mfurer/.local/share/virtualenv) [virtualenv/run/session.py:55] foo: 1472 D got embed update of distribution pip from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/pip.json [virtualenv/app_data/via_disk_folder.py:129] foo: 1473 D got embed update of distribution setuptools from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/setuptools.json [virtualenv/app_data/via_disk_folder.py:129] foo: 1473 D got embed update of distribution wheel from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/wheel.json [virtualenv/app_data/via_disk_folder.py:129] foo: 1480 D install pip from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.3.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] foo: 1481 D install setuptools from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-65.6.3-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] foo: 1481 D install wheel from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.38.4-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] foo: 1483 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.virtualenv to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/pip-22.3.1.virtualenv [virtualenv/util/path/_sync.py:36] foo: 1485 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.dist-info to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/wheel-0.38.4.dist-info [virtualenv/util/path/_sync.py:36] foo: 1486 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.dist-info to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/pip-22.3.1.dist-info [virtualenv/util/path/_sync.py:36] foo: 1488 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/distutils-precedence.pth to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:36] foo: 1491 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/pkg_resources to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:36] foo: 1503 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.virtualenv to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/wheel-0.38.4.virtualenv [virtualenv/util/path/_sync.py:36] foo: 1510 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:36] foo: 1518 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:36] foo: 1595 D generated console scripts wheel wheel3.8 wheel3 wheel-3.8 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] foo: 1611 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/_distutils_hack to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:36] foo: 1617 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:36] foo: 2125 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.virtualenv to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/setuptools-65.6.3.virtualenv [virtualenv/util/path/_sync.py:36] foo: 2128 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.dist-info to /git/repro/tox-list-label/.tox/foo/lib/python3.8/site-packages/setuptools-65.6.3.dist-info [virtualenv/util/path/_sync.py:36] foo: 2148 D generated console scripts [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] foo: 2600 D generated console scripts pip3.8 pip-3.8 pip pip3 [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] foo: 2601 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:61] foo: 2616 D write /git/repro/tox-list-label/.tox/foo/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] foo: 2616 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] foo: 2616 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] foo: 2641 W commands[0]> python -c 'print('"'"'foo'"'"')' [tox/tox_env/api.py:428] foo foo: 2799 I exit 0 (0.15 seconds) /git/repro/tox-list-label> python -c 'print('"'"'foo'"'"')' pid=3596960 [tox/execute/api.py:275] foo: 2800 W commands[1]> python -c 'print('"'"'bar'"'"')' [tox/tox_env/api.py:428] bar foo: 2869 I exit 0 (0.07 seconds) /git/repro/tox-list-label> python -c 'print('"'"'bar'"'"')' pid=3596968 [tox/execute/api.py:275] foo: OK ✔ in 1.61 seconds bar: 2876 I find interpreter for spec PythonSpec(path=/git/repro/tox-list-label/.tox/.tox/bin/python) [virtualenv/discovery/builtin.py:56] bar: 2877 D discover exe from cache /usr - exact False: PythonInfo({'architecture': 64, 'base_exec_prefix': '/usr', 'base_prefix': '/usr', 'distutils_install': {'data': '', 'headers': 'include/python3.8/UNKNOWN', 'platlib': 'lib/python3.8/site-packages', 'purelib': 'lib/python3.8/site-packages', 'scripts': 'bin'}, 'exec_prefix': '/usr', 'executable': '/git/repro/tox-list-label/.tox/.tox/bin/python', 'file_system_encoding': 'utf-8', 'has_venv': True, 'implementation': 'CPython', 'max_size': 9223372036854775807, 'original_executable': '/usr/bin/python3.8', 'os': 'posix', 'path': ['/home/mfurer/.pytools/lib/python3.8/site-packages/virtualenv/discovery', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages'], 'platform': 'linux', 'prefix': '/usr', 'real_prefix': None, 'stdout_encoding': 'utf-8', 'sysconfig': {'makefile_filename': '/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile'}, 'sysconfig_paths': {'data': '{base}', 'include': '{installed_base}/include/python{py_version_short}{abiflags}', 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', 'platstdlib': '{platbase}/lib/python{py_version_short}', 'purelib': '{base}/lib/python{py_version_short}/site-packages', 'scripts': '{base}/bin', 'stdlib': '{installed_base}/lib/python{py_version_short}'}, 'sysconfig_scheme': None, 'sysconfig_vars': {'PYTHONFRAMEWORK': '', 'abiflags': '', 'base': '/usr', 'installed_base': '/usr', 'platbase': '/usr', 'py_version_short': '3.8'}, 'system_executable': '/usr/bin/python3.8', 'system_stdlib': '/usr/lib/python3.8', 'system_stdlib_platform': '/usr/lib/python3.8', 'version': '3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', 'version_info': VersionInfo(major=3, minor=8, micro=10, releaselevel='final', serial=0), 'version_nodot': '38'}) [virtualenv/discovery/py_info.py:435] bar: 2877 I proposed PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/git/repro/tox-list-label/.tox/.tox/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:63] bar: 2877 D accepted PythonInfo(spec=CPython3.8.10.final.0-64, system=/usr/bin/python3.8, exe=/git/repro/tox-list-label/.tox/.tox/bin/python, platform=linux, version='3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]', encoding_fs_io=utf-8-utf-8) [virtualenv/discovery/builtin.py:65] bar: 2890 I create virtual environment via CPython3Posix(dest=/git/repro/tox-list-label/.tox/bar, clear=False, no_vcs_ignore=False, global=False) [virtualenv/run/session.py:48] bar: 2891 D create folder /git/repro/tox-list-label/.tox/bar/bin [virtualenv/util/path/_sync.py:9] bar: 2891 D create folder /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages [virtualenv/util/path/_sync.py:9] bar: 2892 D write /git/repro/tox-list-label/.tox/bar/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] bar: 2892 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] bar: 2892 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] bar: 2893 D symlink /usr/bin/python3.8 to /git/repro/tox-list-label/.tox/bar/bin/python [virtualenv/util/path/_sync.py:28] bar: 2895 D create virtualenv import hook file /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/_virtualenv.pth [virtualenv/create/via_global_ref/api.py:89] bar: 2896 D create /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/_virtualenv.py [virtualenv/create/via_global_ref/api.py:92] bar: 2897 D ============================== target debug ============================== [virtualenv/run/session.py:50] bar: 2897 D debug via /git/repro/tox-list-label/.tox/bar/bin/python /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/create/debug.py [virtualenv/create/creator.py:197] bar: 2897 D { "sys": { "executable": "/git/repro/tox-list-label/.tox/bar/bin/python", "_base_executable": "/git/repro/tox-list-label/.tox/bar/bin/python", "prefix": "/git/repro/tox-list-label/.tox/bar", "base_prefix": "/usr", "real_prefix": null, "exec_prefix": "/git/repro/tox-list-label/.tox/bar", "base_exec_prefix": "/usr", "path": [ "/usr/lib/python38.zip", "/usr/lib/python3.8", "/usr/lib/python3.8/lib-dynload", "/git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages" ], "meta_path": [ "", "", "", "" ], "fs_encoding": "utf-8", "io_encoding": "utf-8" }, "version": "3.8.10 (default, Nov 14 2022, 12:59:47) \n[GCC 9.4.0]", "makefile_filename": "/usr/lib/python3.8/config-3.8-x86_64-linux-gnu/Makefile", "os": "", "site": "", "datetime": "", "math": "", "json": "" } [virtualenv/run/session.py:51] bar: 3238 I add seed packages via FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/mfurer/.local/share/virtualenv) [virtualenv/run/session.py:55] bar: 3241 D got embed update of distribution pip from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/pip.json [virtualenv/app_data/via_disk_folder.py:129] bar: 3244 D got embed update of distribution wheel from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/wheel.json [virtualenv/app_data/via_disk_folder.py:129] bar: 3244 D got embed update of distribution setuptools from /home/mfurer/.local/share/virtualenv/wheel/3.8/embed/3/setuptools.json [virtualenv/app_data/via_disk_folder.py:129] bar: 3247 D install pip from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.3.1-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] bar: 3247 D install wheel from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/wheel-0.38.4-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] bar: 3248 D install setuptools from wheel /git/repro/tox-list-label/.tox/.tox/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/setuptools-65.6.3-py3-none-any.whl via CopyPipInstall [virtualenv/seed/embed/via_app_data/via_app_data.py:47] bar: 3250 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.dist-info to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/wheel-0.38.4.dist-info [virtualenv/util/path/_sync.py:36] bar: 3250 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.virtualenv to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/pip-22.3.1.virtualenv [virtualenv/util/path/_sync.py:36] bar: 3252 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip-22.3.1.dist-info to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/pip-22.3.1.dist-info [virtualenv/util/path/_sync.py:36] bar: 3256 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/distutils-precedence.pth to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/distutils-precedence.pth [virtualenv/util/path/_sync.py:36] bar: 3262 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/pkg_resources to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/pkg_resources [virtualenv/util/path/_sync.py:36] bar: 3272 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel-0.38.4.virtualenv to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/wheel-0.38.4.virtualenv [virtualenv/util/path/_sync.py:36] bar: 3276 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/wheel-0.38.4-py3-none-any/wheel to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/wheel [virtualenv/util/path/_sync.py:36] bar: 3279 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/pip-22.3.1-py3-none-any/pip to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/pip [virtualenv/util/path/_sync.py:36] bar: 3377 D generated console scripts wheel-3.8 wheel3 wheel3.8 wheel [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] bar: 3442 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/_distutils_hack to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/_distutils_hack [virtualenv/util/path/_sync.py:36] bar: 3450 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/setuptools [virtualenv/util/path/_sync.py:36] bar: 4114 D copy /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.virtualenv to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/setuptools-65.6.3.virtualenv [virtualenv/util/path/_sync.py:36] bar: 4118 D copy directory /home/mfurer/.local/share/virtualenv/wheel/3.8/image/1/CopyPipInstall/setuptools-65.6.3-py3-none-any/setuptools-65.6.3.dist-info to /git/repro/tox-list-label/.tox/bar/lib/python3.8/site-packages/setuptools-65.6.3.dist-info [virtualenv/util/path/_sync.py:36] bar: 4146 D generated console scripts [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] bar: 4631 D generated console scripts pip3 pip3.8 pip-3.8 pip [virtualenv/seed/embed/via_app_data/pip_install/base.py:41] bar: 4631 I add activators for Bash, CShell, Fish, Nushell, PowerShell, Python [virtualenv/run/session.py:61] bar: 4651 D write /git/repro/tox-list-label/.tox/bar/pyvenv.cfg [virtualenv/create/pyenv_cfg.py:30] bar: 4651 D home = /usr/bin [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D implementation = CPython [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D version_info = 3.8.10.final.0 [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D virtualenv = 20.17.1 [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D include-system-site-packages = false [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D base-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D base-exec-prefix = /usr [virtualenv/create/pyenv_cfg.py:34] bar: 4651 D base-executable = /usr/bin/python3.8 [virtualenv/create/pyenv_cfg.py:34] bar: 4768 W commands[0]> 'print('"'"'foo'"'"')"' [tox/tox_env/api.py:428] bar: 4791 C exit 2 (0.02 seconds) /git/repro/tox-list-label> 'print('"'"'foo'"'"')"' [tox/execute/api.py:275] foo: OK (1.61=setup[1.39]+cmd[0.15,0.07] seconds) bar: FAIL code 2 (1.92=setup[1.91]+cmd[0.02] seconds) evaluation failed :( (4.47 seconds) ```

Minimal example

If possible, provide a minimal reproducer for the issue:

[tox]
envlist = foo,bar
minversion = 4.4.4

[testenv]
commands:
    foo: python -c "\
        print('foo')"
    python -c "print('bar')"
masenf commented 1 year ago

a workaround is prefixing each line with the specific factor

[tox]
envlist = foo,bar
minversion = 4.4.4

[testenv]
commands:
    foo: python -c "\
    foo:    print('foo')"
    python -c "print('bar')"
gaborbernat commented 1 year ago

Hmm, I would have been surprised if 1 worked; I would have recommended people use option 2. 🤔 Though guess can swap the order of filter and line collapse to allow 1 to work too.