[Pytest-commit] Issue #567: use of 'pytest' in setup.cfg collides with 'pytest' distutils command (hpk42/pytest)

Jason R. Coombs issues-reply at bitbucket.org
Fri Aug 22 04:21:09 CEST 2014

New issue 567: use of 'pytest' in setup.cfg collides with 'pytest' distutils command

Jason R. Coombs:

In [pytest-runner 2](/jaraco/pytest-runner/issue/2), I adapted pytest-runner to support the 'pytest' distutils command. However, because the pytest project itself uses the ``[pytest]`` section of setup.cfg, that conflicts with the same section for the 'pytest' distutils command.

Using the 'pytest' distutils command in a project which specifies, for example, 'norecursedirs', the runner will fail because the pytest-runner distutils command doesn't recognize that parameter (or any other ini options). An example error message is:

error: error in setup.cfg: command 'PyTest' has no such option 'norecursedirs'

I see a few options here:

1. Just use the 'ptr' command name.
2. Have pytest runner distutils command disregard all unrecognized options.
3. Have pytest runner distutils command implement and ignore all of the options that might be presented in setup.cfg. It would need to do this before pytest is present (because args are processed before dependencies such as pytest are downloaded/imported).
4. Have pytest drop support for setup.cfg.
5. Require that users not use setup.cfg for pytest ini options (only support pytest.ini and tox.ini for pytest options when running under distutils).

I suspect there are other options, too. I'm not particularly happy with any of those options, but I'm leaning toward (2).

I've filed the ticket here with pytest for two reasons:

- I want the implementation to be as acceptable as possible for the pytest project to endorse it as a viable integration mechanism.
- I believe the use of the [pytest] section in the setup.cfg by the pytest library is a violation of the [explicit expectation](https://docs.python.org/2/distutils/configfile.html) that those sections are meant for distutils commands.

@hpk42 What is your reaction? What would you suggest?

More information about the pytest-commit mailing list