exit status is not propagated

Issue #103 invalid
Devin Bayer created an issue

When the command being executed fails, coverage still returns with a zero exit status. This means I can't use it to measure coverage of my unit tests and test if the unit tests succeed.

./manage.py test --with-xunit # $? == 1

coverage ./manage.py test --with-xunit # $? == 0

Comments (3)

  1. Ned Batchelder repo owner

    A quick look at the inside of Django's manage.py, it looks like it depends on a call to sys.exit() somewhere deep in the command. Coverage catches SystemExit to return the proper status code, so I'm not sure what's going on here.

  2. Devin Bayer reporter

    Hi. Now I see the problem. I am using buildout (z3c.recipe.scripts) and the generated scripts don't include sys.exit():

    if __name__ == '__main__':

    unlike easy_install:

       load_entry_point('coverage==3.4', 'console_scripts', 'coverage')()

    I have reported the discrepancy, but it would be nice if coverage.main() called sys.exit()

  3. Ned Batchelder repo owner

    I think buildout is at fault here. They should be propagating the exit status. If I invoke sys.exit in my main() function, I lose the ability to test it.

  4. Log in to comment