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

tox4: cannot handle empty envlist for tox -l #1987

Closed
jugmac00 opened this issue Mar 30, 2021 · 3 comments · Fixed by #2000
Closed

tox4: cannot handle empty envlist for tox -l #1987

jugmac00 opened this issue Mar 30, 2021 · 3 comments · Fixed by #2000
Labels
bug:normal affects many people or has quite an impact

Comments

@jugmac00
Copy link
Member

jugmac00 commented Mar 30, 2021

❯ tox4 -l
Traceback (most recent call last):
  File "/home/jugmac00/.local/bin/tox4", line 8, in <module>
    sys.exit(run())
  File "/home/jugmac00/.local/lib/python3.6/site-packages/tox/run.py", line 22, in run
    result = main(sys.argv[1:] if args is None else args)
  File "/home/jugmac00/.local/lib/python3.6/site-packages/tox/run.py", line 47, in main
    result = handler(state)
  File "/home/jugmac00/.local/lib/python3.6/site-packages/tox/session/cmd/legacy.py", line 98, in legacy
    return list_env(state)
  File "/home/jugmac00/.local/lib/python3.6/site-packages/tox/session/cmd/list_env.py", line 27, in list_env
    max_length = max(len(env) for env in (default.envs + extra))
ValueError: max() arg is an empty sequence

reproduction

Just delete the complete content of tox.ini on the rewrite branch.

(I noticed this problem when trying to reproduce #1985)

Interestingly (for me), tox4 list does not crash...

TIL: tox -l and tox list are not aliases => -l and --listenvs are legacy options, and not the same as list

❯ tox4 list
additional environments:
py -> [no description]

(btw what is py??? and why is there an entry, when there is no additional environment)

@jugmac00 jugmac00 added the bug:normal affects many people or has quite an impact label Mar 30, 2021
@jugmac00
Copy link
Member Author

The issue looks straightforward (except for the additional environment: py).

I'd like to work on this one.

@gaborbernat
Copy link
Member

gaborbernat commented Mar 30, 2021

Because empty envlist is translated to py extra. That's by design. tox -l should though make it empty 👍🏻 to be backwards compatible.

@jugmac00
Copy link
Member Author

jugmac00 commented Apr 1, 2021

closed by #1988

@jugmac00 jugmac00 closed this as completed Apr 1, 2021
@gaborbernat gaborbernat linked a pull request Apr 6, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug:normal affects many people or has quite an impact
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants