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

tox -l: ValueError: max() arg is an empty sequence #1343

Closed
blueyed opened this issue Jun 21, 2019 · 1 comment · Fixed by #1529
Closed

tox -l: ValueError: max() arg is an empty sequence #1343

blueyed opened this issue Jun 21, 2019 · 1 comment · Fixed by #1529
Labels
bug:normal pr-merged

Comments

@blueyed
Copy link
Contributor

@blueyed blueyed commented Jun 21, 2019

% mkdir /tmp/test
% cd /tmp/test
% touch tox.ini
% tox -l
Traceback (most recent call last):
  File "…/Vcs/otree-core-private/.venv/bin/tox", line 11, in <module>
    load_entry_point('tox', 'console_scripts', 'tox')()
  File "…/Vcs/tox/src/tox/session/__init__.py", line 44, in cmdline
    main(args)
  File "…/Vcs/tox/src/tox/session/__init__.py", line 68, in main
    exit_code = session.runcommand()
  File "…/Vcs/tox/src/tox/session/__init__.py", line 187, in runcommand
    self.showenvs(all_envs=False, description=show_description)
  File "…/Vcs/tox/src/tox/session/__init__.py", line 291, in showenvs
    show_envs(self.config, all_envs=all_envs, description=description)
  File "…/Vcs/tox/src/tox/session/commands/show_env.py", line 14, in show_envs
    max_length = max(len(env) for env in (default + extra))
ValueError: max() arg is an empty sequence

Fix:

diff --git i/src/tox/session/commands/show_env.py w/src/tox/session/commands/show_env.py
index ae05c84..a6d16f0 100644
--- i/src/tox/session/commands/show_env.py
+++ w/src/tox/session/commands/show_env.py
@@ -11,6 +11,9 @@ def show_envs(config, all_envs=False, description=False):
 
     if description and default:
         report.line("default environments:")
+    envs = default + extra
+    if not envs:
+        return
     max_length = max(len(env) for env in (default + extra))
 
     def report_env(e):

tox 3.12.1, but also on master.

@blueyed blueyed added the bug:normal label Jun 21, 2019
@pletnes
Copy link

@pletnes pletnes commented Jan 16, 2020

I found the same bug.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug:normal pr-merged
Projects
None yet
2 participants