Skip to content

Conversation

hroncok
Copy link
Contributor

@hroncok hroncok commented Aug 6, 2020

Do not use setup.cfg file that does not have tox:tox namespace

When tox is invoked without a tox configuration file (and without command line
options that could be used instead), it fails with:

$ tox
ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found

This is useful: If there is no config, test didn't run and such error should
not pass silently.

However, until this commit, when there was a setup.cfg file it was considered
as a tox config even when there was no [tox:tox] section:

$ tox
GLOB sdist-make: .../setup.py
python create: .../.tox/python
python inst: ...
python installed: ...
python run-test-pre: PYTHONHASHSEED='1234567890'
___________________________________ summary ____________________________________
  python: commands succeeded
  congratulations :)

That is not safe, because setup.cfg can exist even if there is no tox
configuration in it and the success creates a false sense of safety.

To fix this and to match the behavior of pyproject.toml without a tox section,
tox now skips setup.cfg, if there is no [tox:tox] section.

Fixes #1045

Contribution checklist:

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation
  • added relevant issue keyword in message body
  • added news fragment in changelog folder
  • added yourself to CONTRIBUTORS (preserving alphabetical order)

When tox is invoked without a tox configuration file (and without command line
options that could be used instead), it fails with:

    $ tox
    ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found

This is useful: If there is no config, test didn't run and such error should
not pass silently.

However, until this commit, when there was a setup.cfg file it was considered
as a tox config even when there was no [tox:tox] section:

    $ tox
    GLOB sdist-make: .../setup.py
    python create: .../.tox/python
    python inst: ...
    python installed: ...
    python run-test-pre: PYTHONHASHSEED='1234567890'
    ___________________________________ summary ____________________________________
      python: commands succeeded
      congratulations :)

That is not safe, because setup.cfg can exist even if there is no tox
configuration in it and the success creates a false sense of safety.

To fix this and to match the behavior of pyproject.toml without a tox section,
tox now skips setup.cfg, if there is no [tox:tox] section.

Fixes tox-dev#1045
@asottile
Copy link
Contributor

asottile commented Aug 6, 2020

heheh I actually noticed this behaviour recently and considered it a feature (at least for tox --devenv which just works even without tox configuration)

will try this branch out and poke around a bit 👍

@hroncok
Copy link
Contributor Author

hroncok commented Aug 6, 2020

Well, if it is useful to allow devenv without configuration, let's do that explicitly and not just with setup.cfg?

@gaborbernat gaborbernat merged commit 6f5bee8 into tox-dev:master Aug 6, 2020
@hroncok hroncok deleted the skip_setup_cfg_no_tox branch August 6, 2020 09:39
@hroncok
Copy link
Contributor Author

hroncok commented Aug 6, 2020

@asottile #1643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

do not use setup.cfg file that does not have tox:tox namespace
3 participants