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

exit status is not propagated #103

Closed
nedbat opened this issue Dec 28, 2010 · 3 comments
Closed

exit status is not propagated #103

nedbat opened this issue Dec 28, 2010 · 3 comments
Labels
enhancement New feature or request run

Comments

@nedbat
Copy link
Owner

nedbat commented Dec 28, 2010

Originally reported by Devin Bayer (Bitbucket: akvadrako, GitHub: akvadrako)


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


@nedbat
Copy link
Owner Author

nedbat commented Dec 28, 2010

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.

@nedbat
Copy link
Owner Author

nedbat commented Dec 28, 2010

Original comment by Devin Bayer (Bitbucket: akvadrako, GitHub: akvadrako)


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__':
    coverage.main()

unlike easy_install:

sys.exit(
   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()

@nedbat
Copy link
Owner Author

nedbat commented Oct 30, 2012

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.

@nedbat nedbat closed this as completed Oct 30, 2012
@nedbat nedbat added major enhancement New feature or request run labels Jun 23, 2018
agronholm added a commit to agronholm/coveragepy that referenced this issue Aug 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request run
Projects
None yet
Development

No branches or pull requests

1 participant