
Marius Gedminas wrote:
It's not a problem with the recipe, it's a problem with zope.testing, or,
Sorry, that should have been obvious to me. No idea what made me blame it on the recipe...
more fundamentally, with Python. The sys.settrace hook used to implement coverage tracing is non-recursive.
zope.testing tests its own ability to do coverage tracing, and since the test is run in the same Python process as the test runner, the side effect of the test's calling sys.settrace is that the runner is no longer able to trace coverage.
Ah, this makes some sense since the function that was reported uncovered after the change is tested later in the same doc test.
list(obj) cals obj.__len__ as an optimization. This results in an infinite recursive loop, but then list(obj) traps that, hides it, and does the brute-force list conversion. As a side effect of sys.settrace, the stack overflow RuntimeError happens inside the tracing hook and Python removes it for misbehaving. Tracing stops from that point on.
That's what I call gory details...
Python's doctest also had side effects that used to disable tracing.
OK, so it's no longer a subject for this list at least. -- Thomas