[Zope-dev] zope.testrunner test failures on windows
Marius Gedminas
marius at gedmin.as
Fri Aug 15 11:31:46 EDT 2008
On Tue, Aug 12, 2008 at 09:17:39PM +0100, Chris Withers wrote:
> I could have sworn I reported this before but couldn't find anything in
> the archives so apologies if I have posted this before...
I have a feeling of deja vu about this...
> Anyway, running zope.testrunner's trunk's tests on windows seems to have
> some problems. These don't occur when running them on Linux.
I'm vaguely interested in fixing these, but I don't do Windows.
> File "zope.testing\src\zope\testing\testrunner\testrunner-debugging-
> layer-setup.test", line 45, in testrunner-debugging-layer-setup.test
...
> File "zope.testing\src\zope\testing\testrunner\find.py", line
> 103, in find_suites
> suite = StartUpFailure(
Let's look at this statement closer:
try:
module = import_name(module_name)
except KeyboardInterrupt:
raise
except:
--> suite = StartUpFailure(
options, module_name,
sys.exc_info()[:2]
+ (sys.exc_info()[2].tb_next.tb_next,),
)
It would appear that the traceback is shallower than the code expects. I don't
know why it is trying to strip the first two frames of the stack, either.
> File "zope.testing\src\zope\testing\testrunner\find.py", line
> 36, in __init__
> post_mortem(exc_info)
> File "zope.testing\src\zope\testing\testrunner\runner.py", lin
> e 717, in post_mortem
> pdb.post_mortem(exc_info[2])
> File "Python24\lib\pdb.py", line 1016, in post_mortem
> while t.tb_next is not None:
Apparently the traceback was exactly two frames deep, and with those stripped,
the code passed None to pdb.post_mortem().
It would be good if someone who has Windows and Linux could compare the
tracebacks in question.
I'd also suggest extracting the stack frame stripping into a function
that would be a bit more defensive:
def strip_tb_frames((exc_type, exc_value, tb), count):
while tb.tb_next is not None and count > 0:
tb = tb.tb_next
count -= 1
return (exc_type, exc_value, tb)
and call it like this
suite = StartUpFailure(
options, module_name,
strip_tb_frames(sys.exc_info(), 2)
)
(Why oh why does Guido want to take away my beloved implicit argument
tuple unpacking in Python 3.0?)
> AttributeError: 'NoneType' object has no attribute 'tb_next'
>
Next error:
> Failure in test zope.testing\src\zope\testing\testrunner\testrunner-
> coverage-win32.txt
> Failed doctest test for testrunner-coverage-win32.txt
> File "zope.testing\src\zope\testing\testrunner\testrunner-coverage
> -win32.txt", line 0
The name of this test suggests it's only run under Win32, so any refactoring
done on Linux is likely to break it without anyone noticing.
> ----------------------------------------------------------------------
> File "zope.testing\src\zope\testing\testrunner\testrunner-coverage-w
> in32.txt", line 14, in testrunner-coverage-win32.txt
> Failed example:
> ignore = testrunner.TestIgnore(WinOptions())
> Exception raised:
> Traceback (most recent call last):
> File "zope.testing\src\zope\testing\doctest.py", line 1356, in
> __run
> compileflags, 1) in test.globs
> File "<doctest testrunner-coverage-win32.txt[2]>", line 1, in ?
> AttributeError: 'module' object has no attribute 'TestIgnore'
TestIgnore moved from zope.testing.testrunner to
zope.testing.testrunner.coverage. It should be simple to fix the test.
> Ran 183 tests with 2 failures and 0 errors in 43.094 seconds.
> Tearing down left over layers:
> Tear down zope.testing.testrunner.layer.UnitTests in 0.000 seconds.
Marius Gedminas
--
An NT server can be run by an idiot, and usually is.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20080815/aa2a464d/attachment.bin
More information about the Zope-Dev
mailing list