New issue 521: ghost.exit() in py.test teardown/finalizer causes Python to exit 
with return code 1
https://bitbucket.org/hpk42/pytest/issue/521/ghostexit-in-pytest-teardown-finalizer

Daniel Hahler:

Using Ghost.py with Xvfb (on a Linux framebuffer console (Ctrl-Alt-F1)), causes 
Python to exit with return code 1, although py.test calls `sys.exit(0)` after 
the tests have all passed.

It can be reproduced using this `test_ghost.py` file:

    import pytest
    from ghost import Ghost

    @pytest.yield_fixture()
    def ghost():
        ghost = Ghost()
        yield ghost
        ghost.exit()

    def test_ghost(ghost):
        assert True

TEST CASE:
1. Create a new virtualenv:
   `mktmpenv`

2. Install py.test and Ghost.py:
   `bin/pip install pytest git+git://github.com/jeanphix/Ghost.py.git`

3. Install PySide, e.g. by copying it (after installing it systemwide):
    cp -a /usr/lib/python2.7/dist-packages/PySide 
$VIRTUAL_ENV/lib/python2.7/site-packages/PySide

   I am using `python-pyside.qtwebkit` (version 1.2.1-4build1) on Ubuntu 14.04.

4. Run the above test file:
   `py.test test_ghost.py`

I could not find the reason for this to happen using `ipdb` stepping.

It would be nice if `py.test` could ensure somehow that its own exit code is 
being used, and additionally output some warning in case a finalizer acts like 
the one above.


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

Reply via email to