Skip to content

Regression since 2.5.0: empty commands section causes error #454

@asottile

Description

@asottile

We often use this pattern such that tox is creating our virtual environments for us:

tox.ini

[tox]
skipsdist = true

[testenv:venv]
deps = pre-commit
commands =

Under 2.4.1

I get (what I expect):

$ tox -e venv
venv recreate: /tmp/fo/.tox/venv
venv installdeps: pre-commit
venv installed: appdirs==1.4.0,aspy.yaml==0.2.2,cached-property==1.3.0,functools32==3.2.3.post2,jsonschema==2.6.0,nodeenv==1.1.2,packaging==16.8,pre-commit==0.12.2,pyparsing==2.1.10,PyYAML==3.12,six==1.10.0,virtualenv==15.1.0
venv runtests: PYTHONHASHSEED='2591024316'
___________________________________ summary ____________________________________
  venv: commands succeeded
  congratulations :)

2.5.0

This is an error:

$ tox -e venv
venv create: /tmp/fo/.tox/venv
venv installdeps: pre-commit
venv installed: appdirs==1.4.0,aspy.yaml==0.2.2,cached-property==1.3.0,functools32==3.2.3.post2,jsonschema==2.6.0,nodeenv==1.1.2,packaging==16.8,pre-commit==0.12.2,pyparsing==2.1.10,PyYAML==3.12,six==1.10.0,virtualenv==15.1.0
ERROR: Commands not specified. Please update relevant section of /tmp/fo/tox.ini
___________________________________ summary ____________________________________
ERROR:   venv: nothing to do

workaround

A (kinda unfortunate) workaround is to do something like:

commands = python -c 'print("done!")'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions