Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest fails at first test with Exit: FATAL #2047

Closed
ssbarnea opened this issue Nov 8, 2016 · 5 comments
Closed

pytest fails at first test with Exit: FATAL #2047

ssbarnea opened this issue Nov 8, 2016 · 5 comments

Comments

@ssbarnea
Copy link
Member

ssbarnea commented Nov 8, 2016

I encounter a really strange issue on Jira python library, it seems that pytest exist during the execution of the first encountered test and doesn't give any explanation. I checked and there is nothing special about this test, disabling it it will move the error to the next one.

Debug log and pip freeze: https://gist.github.com/ssbarnea/a6799f7b648a675800970515219d4c82
The tests are at https://github.com/pycontribs/jira/blob/develop/tests/tests.py

It seems that this problem happens with both 2.9.2 and 3.0.3 on both Mac OS and Linux, with both python 2 and 3.

I am not sure if that's a real bug in pytest but clearly the behaviour is confusing.

@The-Compiler
Copy link
Member

Can you show the full, exact output you get? That smells like something like a segmentation fault, in which case there's nothing pytest can do.

@ssbarnea
Copy link
Member Author

ssbarnea commented Nov 8, 2016

$ pytest tests
=============================================================================================== test session starts ===============================================================================================
platform linux2 -- Python 2.7.5, pytest-3.0.3, py-1.4.31, pluggy-0.4.0 -- /usr/bin/python
cachedir: .cache
rootdir: /media/psf/Home/redhat/jira, inifile: pytest.ini
collected 122 items

tests/tests.py::UniversalResourceTests::test_pickling_resource

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Exit: FATAL !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
========================================================================================== no tests ran in 8.34 seconds ===========================================================================================

@The-Compiler
Copy link
Member

The debug log says:

    pytest_keyboard_interrupt [hook]
        excinfo: /usr/local/lib/python2.7/site-packages/_pytest/runner.py:516: Exit: FATAL

Which comes from your JiraTestManager which is hiding exceptions that way...

class JiraTestManager(object):
    # ...

    def __init__(self):
        # ...

          try:
              # 165 lines of stuff...
          except Exception:
              logging.exception("Basic test setup failed")
              self.initialized = 1
              py.test.exit("FATAL")

@ssbarnea
Copy link
Member Author

ssbarnea commented Nov 8, 2016

Thanks! Now I feel really stupid, I was sure that searched for the FATAL string in my code. Anyway that exception lines needs rework.

BTW, do you know a way to display something on the screen (like details about this "special" error) even if I do have the stderr/stdout capture enabled?

@ssbarnea ssbarnea closed this as completed Nov 8, 2016
@The-Compiler
Copy link
Member

Why not simply let the exception propagate and let pytest handle the rest?

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

No branches or pull requests

2 participants