This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: unittest.TestProgram uses sys.exit()
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.5
Status: closed Resolution: duplicate
Dependencies: Superseder: Option to not-exit on test
View: 3379
Assigned To: Nosy List: ajaksu2, facundobatista, pupeno, tuben
Priority: normal Keywords:

Created on 2008-04-23 13:59 by tuben, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg65698 - (view) Author: Johan Tufvesson (tuben) Date: 2008-04-23 13:59
The class TestProgram (and its synonym "main") in module unittest is
(probably) meant to be an easy way to use the functionality of the
module unittest. It is very surprising (and error-prone) that it uses
sys.exit() with a status code instead of making a return with the same
status code.

Clean-up actions after the call to unittest.main() are not executed.
msg69530 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-07-11 02:55
That class is normally used at the end of the testing suite, as is
recommended in the documentation.

In any case, I don't see that like a bug, so we shouldn't be changing
that behaviour, because of compatibility.

What do you think? Maybe the documentation should be more explicit about
this? Thanks!
msg69946 - (view) Author: J. Pablo Fernández (pupeno) Date: 2008-07-18 09:37
I was bothered by this 'bug' ages ago, and I was work-arounding it. So
now I've spent some time in 'fixing' it with the patches on issue #3379.
msg85724 - (view) Author: Daniel Diniz (ajaksu2) * (Python triager) Date: 2009-04-07 16:05
Closing as issue 3379 has more discussion and patch.
Date User Action Args
2022-04-11 14:56:33adminsetgithub: 46926
2009-04-07 16:05:23ajaksu2setstatus: open -> closed
priority: normal
superseder: Option to not-exit on test

nosy: + ajaksu2
messages: + msg85724
resolution: duplicate
2008-07-18 09:37:11pupenosetnosy: + pupeno
messages: + msg69946
2008-07-11 02:55:26facundobatistasetnosy: + facundobatista
messages: + msg69530
2008-04-23 13:59:46tubencreate