Skip to content

4.21.2: running the 'tox -e fix' on main branch gives a stacktrace related to TOML loader #3405

Closed
@ssbarnea

Description

@ssbarnea

Issue

Running tox -e fix is advertised as part of PR template but when someone tries to run it on current versions, the might get an ugly stacktrace related to toml loading.

  • I even removed the tox plugin that I had and no change.
  • I tried running tox -e type and that works, it seems that the issue has something to do with fix environment in particular.

Environment

Provide at least:

  • OS:
Output of pip list of the host Python, where tox is installed
$ python --version -V
Python 3.12.7 (main, Oct  3 2024, 12:19:59) [Clang 16.0.0 (clang-1600.0.26.3)]

Package                    Version         Editable project location
-------------------------- --------------- ----------------------------
aiohappyeyeballs           2.4.3
aiohttp                    3.10.9
aiosignal                  1.3.1
ansible-builder            3.1.0
ansible-compat             24.9.1
ansible-core               2.17.4
ansible-creator            24.9.0
ansible-dev-environment    24.9.0
ansible-dev-tools          24.9.1.dev26
ansible-lint               24.9.2
ansible-navigator          24.9.0
ansible_rulebook           1.1.1
ansible-runner             2.4.0
ansible-sign               0.1.1
asgiref                    3.8.1
astroid                    3.3.5
asttokens                  2.4.1
attrs                      24.2.0
babel                      2.16.0
bashate                    2.1.1
beautifulsoup4             4.12.3
bindep                     2.11.0
black                      24.8.0
bracex                     2.5.post1
build                      1.2.2.post1
cachetools                 5.5.0
cairocffi                  1.7.1
CairoSVG                   2.7.1
certifi                    2024.8.30
cffi                       1.17.1
cfgv                       3.4.0
chardet                    5.2.0
charset-normalizer         3.3.2
click                      8.1.7
click-help-colors          0.9.4
colorama                   0.4.6
coverage                   7.6.1
cryptography               43.0.1
csscompressor              0.9.5
cssselect2                 0.7.0
decorator                  5.1.1
defusedxml                 0.7.1
dill                       0.3.9
distlib                    0.3.8
distro                     1.9.0
Django                     5.1.1
django-stubs               5.1.0
django-stubs-ext           5.1.0
dnspython                  2.7.0
docstring_parser_fork      0.0.9
docutils                   0.21.2
dpath                      2.2.0
drools_jpy                 0.3.9
enrich                     1.2.7
exceptiongroup             1.2.2
execnet                    2.1.1
executing                  2.1.0
filelock                   3.16.1
flake8                     7.1.1
frozenlist                 1.4.1
ghp-import                 2.1.0
griffe                     1.3.2
gunicorn                   23.0.0
htmlmin2                   0.1.13
identify                   2.6.1
idna                       3.10
importlib_metadata         8.5.0
iniconfig                  2.0.0
ipdb                       0.13.13
ipython                    8.28.0
isodate                    0.6.1
isort                      5.13.2
janus                      1.0.0
jedi                       0.19.1
Jinja2                     3.1.4
jpy                        0.18.0
jsmin                      3.0.1
jsonschema                 4.23.0
jsonschema-path            0.3.3
jsonschema-specifications  2024.10.1
lazy-object-proxy          1.10.0
libtmux                    0.37.0
LinkChecker                10.5.0
lockfile                   0.12.2
Markdown                   3.7
markdown-exec              1.9.3
markdown-include           0.8.1
markdown-it-py             3.0.0
MarkupSafe                 2.1.5
matplotlib-inline          0.1.7
mccabe                     0.7.0
mdurl                      0.1.2
mergedeep                  1.3.4
mkdocs                     1.6.1
mkdocs-ansible             24.3.1
mkdocs-autorefs            1.2.0
mkdocs-gen-files           0.5.0
mkdocs-get-deps            0.2.0
mkdocs-htmlproofer-plugin  1.3.0
mkdocs-macros-plugin       1.2.0
mkdocs-material            9.5.39
mkdocs-material-extensions 1.3.1
mkdocs-minify-plugin       0.8.0
mkdocs-monorepo-plugin     1.1.0
mkdocstrings               0.26.1
mkdocstrings-python        1.11.1
molecule                   24.9.0
more-itertools             10.5.0
multidict                  6.1.0
mypy                       1.11.2
mypy-extensions            1.0.0
mypy_primer                0.1.0           /Volumes/code/os/mypy_primer
nodeenv                    1.9.1
onigurumacffi              1.3.0
openapi-core               0.19.4
openapi-schema-validator   0.6.2
openapi-spec-validator     0.7.1
packaging                  24.1
paginate                   0.5.7
parse                      1.20.2
Parsley                    1.3
parso                      0.8.4
pathable                   0.4.3
pathspec                   0.12.1
pbr                        6.1.0
pexpect                    4.9.0
pillow                     10.4.0
pip                        24.2
pip-tools                  7.4.1
pipdeptree                 2.23.4
platformdirs               4.3.6
pluggy                     1.5.0
pre_commit                 4.0.1
prompt_toolkit             3.0.48
propcache                  0.2.0
psycopg                    3.2.3
psycopg-binary             3.2.3
ptyprocess                 0.7.0
pure_eval                  0.2.3
pycodestyle                2.12.1
pycparser                  2.22
pydoclint                  0.5.9
pyflakes                   3.2.0
Pygments                   2.18.0
pylint                     3.3.1
pymdown-extensions         10.11.2
pyparsing                  3.1.4
pyproject-api              1.8.0
pyproject_hooks            1.2.0
pytest                     8.3.3
pytest-ansible             24.9.0
pytest-xdist               3.6.1
python-daemon              3.0.1
python-dateutil            2.9.0.post0
python-gnupg               0.5.3
python-slugify             8.0.4
PyYAML                     6.0.2
pyyaml_env_tag             0.1
referencing                0.31.1
regex                      2024.9.11
requests                   2.32.3
resolvelib                 1.0.1
rfc3339-validator          0.1.4
rich                       13.9.2
rpds-py                    0.20.0
ruamel.yaml                0.18.6
ruamel.yaml.clib           0.2.8
ruff                       0.6.9
setuptools                 75.1.0
setuptools-scm             8.0.4
six                        1.16.0
soupsieve                  2.6
sqlparse                   0.5.1
stack-data                 0.6.3
subprocess-tee             0.4.2
termcolor                  2.5.0
text-unidecode             1.3
tinycss2                   1.3.0
toml-sort                  0.23.1
tomli                      2.0.2
tomlkit                    0.13.2
tox                        4.21.2
tox-ansible                24.9.0
traitlets                  5.14.3
types-PyYAML               6.0.12.20240917
types-requests             2.32.0.20240914
typing_extensions          4.12.2
tzdata                     2024.2
urllib3                    2.2.3
uv                         0.4.20
virtualenv                 20.26.6
watchdog                   5.0.3
wcmatch                    10.0
wcwidth                    0.2.13
webencodings               0.5.1
websockets                 13.1
Werkzeug                   3.0.4
wheel                      0.44.0
xxhash                     3.5.0
yamllint                   1.35.1
yarl                       1.14.0
zipp                       3.20.2

Output of running tox

Output of tox -rvv
$ tox -e fix
fix: internal error
Traceback (most recent call last):
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 48, in _evaluate
    code, outcomes = run_commands(tox_env, no_test)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 85, in run_commands
    status_main = run_command_set(tox_env, "commands", chdir, ignore_errors, outcomes)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/session/cmd/run/single.py", line 104, in run_command_set
    command_set: list[Command] = tox_env.conf[key]
                                 ~~~~~~~~~~~~^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/sets.py", line 116, in __getitem__
    return self.load(item)
           ^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/sets.py", line 127, in load
    return config_definition.__call__(self._conf, self.loaders, ConfigLoadArgs(chain, self.name, self.env_name))  # noqa: PLC2801
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/of_type.py", line 109, in __call__
    value = loader.load(key, self.of_type, self.factory, conf, args)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/api.py", line 148, in load
    converted = self.build(key, of_type, factory, conf, raw, args)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/__init__.py", line 66, in build
    return self.to(exploded, of_type, factory)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/convert.py", line 33, in to
    return self._to_typing(raw, of_type, factory)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/convert.py", line 60, in _to_typing
    result = [self.to(i, entry_type, factory) for i in self.to_list(raw, entry_type)]
                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/__init__.py", line 82, in to_list
    return iter(validate(value, of))  # type: ignore[call-overload,no-any-return]
                ^^^^^^^^^^^^^^^^^^^
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/_validate.py", line 37, in validate
    validate(va, entry_type)
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/_validate.py", line 42, in validate
    validate(val, List[str])
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/_validate.py", line 37, in validate
    validate(va, entry_type)
  File "/Users/ssbarnea/.asdf/installs/python/3.12.7/lib/python3.12/site-packages/tox/config/loader/toml/_validate.py", line 78, in validate
    raise TypeError(msg)
TypeError: [] is not of type 'str'
  fix: FAIL code 2 (0.04 seconds)
  evaluation failed :( (0.10 seconds)
FAIL: 2

Minimal example

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug:normalaffects many people or has quite an impact

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions