[New-bugs-announce] [issue21178] doctest cause warnings in tests using generators
Ontje Lünsdorf
report at bugs.python.org
Tue Apr 8 12:49:06 CEST 2014
New submission from Ontje Lünsdorf:
The attached doctest raises a warning since Python 3.4:
$ python -m doctest doctest.txt
Exception ignored in: <generator object foo at 0x7f9ee38aaca8>
Traceback (most recent call last):
File "<doctest doctest.txt[1]>", line 4, in foo
NameError: name 'socket' is not defined
My guess is that doctest cleans up globals() of the test snippet (thereby deleting socket). Afterwards python cleans up the generator by sending in a GeneratorExit exception. The except block will now fail because socket is not available anymore.
----------
components: Tests
files: doctest.txt
messages: 215750
nosy: oluensdorf
priority: normal
severity: normal
status: open
title: doctest cause warnings in tests using generators
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file34760/doctest.txt
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21178>
_______________________________________
More information about the New-bugs-announce
mailing list