classification
Title: A public facing API for __unittest = True
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution:
Dependencies: Superseder: API for excluding methods from unittest stack traces
View: 1705520
Assigned To: Nosy List: Julian, eric.snow, michael.foord, r.david.murray
Priority: normal Keywords:

Created on 2012-09-09 19:08 by Julian, last changed 2012-09-10 14:32 by eric.snow. This issue is now closed.

Messages (4)
msg170126 - (view) Author: Julian Berman (Julian) * Date: 2012-09-09 19:08
Can `__unittest = True`, which is used to hide stack frames from tracebacks inside the testing framework, be documented as being public, or, if that's not acceptable, be replaced by something that is? `_exc_info_to_string` is a hairy function to need to rewrite when authoring a testing framework, but it's a rather common thing to want, and would be nice if it was easily done by integrating with what `TestCase` is already doing.

It's also (with or without formal blessing) being used in the wild in at least one place I know of here http://bazaar.launchpad.net/~testtools-committers/testtools/trunk/view/head:/testtools/testcase.py#L798  and since it's not terribly critical and will fail rather nicely even if the API changes suddenly I'd bet other places are using it too, though I haven't bothered to check.

See also http://twistedmatrix.com/trac/ticket/4127  which would be easier to implement if this were acceptable to use for external code.
msg170128 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-09-09 19:36
This is a duplicate of issue 1705520. Since Michael obviously hasn't gotten to it yet, a proposed patch might move things along.
msg170129 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2012-09-09 19:36
Whatever we do must be backwards compatible. The question is, is a better api that doesn't use stack frames (which is a hack in my opinion) even possible?
msg170191 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2012-09-10 14:32
yeah, I keep thinking we need a better API for managing tracebacks.  One of these days...
History
Date User Action Args
2012-09-10 14:32:45eric.snowsetnosy: + eric.snow
messages: + msg170191
2012-09-09 19:36:24michael.foordsetmessages: + msg170129
2012-09-09 19:36:08r.david.murraysetstatus: open -> closed

nosy: + r.david.murray
messages: + msg170128

superseder: API for excluding methods from unittest stack traces
stage: resolved
2012-09-09 19:08:04Juliancreate