[New-bugs-announce] [issue21882] turtledemo modules imported by test___all__ cause side effects or failures

Ned Deily report at bugs.python.org
Mon Jun 30 01:56:01 CEST 2014


New submission from Ned Deily:

Although the turtledemo modules are not run directly during by "make test" or by "python -m test -uall", they are currently being inadvertently imported by test___all__.  This can lead to test failures and side effects because some of the turtledemo modules execute code on import, rather than only when being run via calls to their main() functions.  A quick glance shows problems with the following demos: clock (calls mode("logo") which causes a window to appear), colormixer (which unconditionally calls sys.setrecursionlimit()), and two_canvases (which is not structured using functions at all).  Depending on how tests are run, these problems can cause serious side effects.

At a minimum,
1. test___all__ should be changed to exclude turtledemo modules.

It would also be nice to make the demos better citizens:
2. move the mode() call to main() in clock
3. move the setrecursionlimit call to main() and save and restore the original value on exit
4. restructure two_canvases to be like the other demos.
5. double-check all demos for other cases where interpreter state is changed and not restored.

----------
components: Tests
keywords: easy
messages: 221921
nosy: ned.deily
priority: normal
severity: normal
stage: test needed
status: open
title: turtledemo modules imported by test___all__ cause side effects or failures
versions: Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21882>
_______________________________________


More information about the New-bugs-announce mailing list