[py-dev] INTERNAL ERROR doesn't give a good exit code?
John Anderson
sontek at gmail.com
Sat Jul 7 05:30:23 CEST 2012
Turns out it was the documented setup.py PyTestCommand I found:
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs aren't loaded
import pytest
pytest.main(self.test_args)
Changed the last line to
result = pytest.main(self.test_args)
sys.exit(result)
and everything is working.
On Fri, Jul 6, 2012 at 9:31 PM, John Anderson <sontek at gmail.com> wrote:
> I'm running my builds on travis-ci and I had some bad imports and it
> threw an INTERNAL ERROR on py.test, but gave an exit code 0 so the
> build doesn't fail.. Any way to fix this?
>
>
> ============================= test session starts ==============================
>
> 626platform linux2 -- Python 2.7.2 -- pytest-2.2.4
>
> 627INTERNALERROR> Traceback (most recent call last):
>
> 628INTERNALERROR> File
> "/home/vagrant/virtualenv/python2.7/local/lib/python2.7/site-packages/_pytest/main.py",
> line 72, in wrap_session
>
> 629INTERNALERROR> config.hook.pytest_sessionstart(session=session)
>
> 630INTERNALERROR> File
> "/home/vagrant/virtualenv/python2.7/local/lib/python2.7/site-packages/_pytest/core.py",
> line 421, in __call__
>
> 631INTERNALERROR> return self._docall(methods, kwargs)
>
> 632INTERNALERROR> File
> "/home/vagrant/virtualenv/python2.7/local/lib/python2.7/site-packages/_pytest/core.py",
> line 432, in _docall
>
> 633INTERNALERROR> res = mc.execute()
>
> 634INTERNALERROR> File
> "/home/vagrant/virtualenv/python2.7/local/lib/python2.7/site-packages/_pytest/core.py",
> line 350, in execute
>
> 635INTERNALERROR> res = method(**kwargs)
>
> 636INTERNALERROR> File
> "/home/vagrant/builds/sontek/hiero/conftest.py", line 10, in
> pytest_sessionstart
>
> 637INTERNALERROR> from hiero.tests.models import Base
>
> 638INTERNALERROR> File
> "/home/vagrant/builds/sontek/hiero/hiero/__init__.py", line 2, in
> <module>
>
> 639INTERNALERROR> from hem.config import get_class_from_config
>
> 640INTERNALERROR> ImportError: No module named hem.config
>
> 641
>
> 642Done. Build script exited with: 0
More information about the Pytest-dev
mailing list