[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-07-23 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I opened #22051 about removing reload to force better code. Since the tests are 
passing and I think the demo modules should be minimally tested by importing, 
and no one has said otherwise since the fix, I am closing this.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-30 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +jesstess

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am working on the turtle demos now. Victor gave more info in #21884.

I was partly wrong in my comments. turtledemo uses reload to re-initialize 
demos when one switches between them. I am tempted to remove this as part of 
discouraging side-effects on import. It is not a good example to be followed.

--
assignee:  - terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c173a34f20c0 by Terry Jan Reedy in branch '2.7':
Issue #21882: In turtle demos, remove module scope gui and sys calls by
http://hg.python.org/cpython/rev/c173a34f20c0

New changeset fcfa9c5a00fd by Terry Jan Reedy in branch '3.4':
Issue #21882: In turtle demos, remove module scope gui and sys calls by
http://hg.python.org/cpython/rev/fcfa9c5a00fd

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

2. Done
3. I just removed the setrecursionlimit call, added for 3.0. I moved the 
colormixer sliders around for longer than anyone is likely to and it ran fine.
4. two-canvases works fine now. The extra window just has to be clicked away.
5. nim had a call to turtle.Screen, now in main().
6. Done
Let's see what the buildbots say.

1. Since demos are part of the delivered stdlib, it could be argued that they 
should get minimal sanity check of being importable. I don't care either way. I 
leave this to either of you.

--
assignee: terry.reedy - 
stage: test needed - commit review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The __all__ test now passes on Snow Leapard.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-29 Thread Ned Deily

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 rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-29 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 1. test___all__ should be changed to exclude turtledemo modules.

Agreed. In general, the test suite shouldn't open any GUI windows except if the 
gui resource is enabled (which isn't the default).
The turtledemo behaviour is quite new in that regard.

--
nosy: +pitrou, terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21882] turtledemo modules imported by test___all__ cause side effects or failures

2014-06-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

6. Add 'good citizenship' note to demohelp.txt. Also point out that all turtle 
initialiazation should be in main anyway (see 2. and 3. below). Demo should run 
independently of what other demos do.

re 2: If the mode call is needed, it is a bug that it is not main() as another 
demo could change it.

re 3: ditto, though much less likely.

re 4: As mentioned in #14117, two_canvases is buggy in that the code is not 
displayed. I added a comment in the file about things that don't work. A main 
function is the next thing to try anyway.

If no one does the turtledemo changes, I probably will soon.

--
versions: +Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21882
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com