New issue 711: Confusing exit code when pkg_resources fails
https://bitbucket.org/pytest-dev/pytest/issue/711/confusing-exit-code-when-pkg_resources

Diogo Campos:

When pytest fails to start (e.g., missing a dependency), the test command fails 
with something like this:

```
#!python

Traceback (most recent call last):
  File "XXX/pytest-2.6.4/Scripts/py.test-script.py", line 5, in <module>
    from pkg_resources import load_entry_point
  File "XXX\setuptools-12.2\lib\site-packages\pkg_resources\__init__.py", line 
3020, in <module>
    working_set = WorkingSet._build_master()
  File "XXX\setuptools-12.2\lib\site-packages\pkg_resources\__init__.py", line 
614, in _build_master
    ws.require(__requires__)
  File "XXX\setuptools-12.2\lib\site-packages\pkg_resources\__init__.py", line 
920, in require
    needed = self.resolve(parse_requirements(requirements))
  File "XXX\setuptools-12.2\lib\site-packages\pkg_resources\__init__.py", line 
807, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: colorama
```

And the command returns **1**.

This is confusing because pytest states that exit code **1** means "tests 
failed", while "internal error" or "usage error" should return **2**/**3**.

I'm not sure if there is much that can be done to fix this, since that **1** is 
given by setuptools, and not pytest.

Overall, using such a common error exit code **1** to indicate anything other 
than errors might be a bad idea.


_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to