New submission from Terry J. Reedy <tjre...@udel.edu>:

python -m idlelib.pyshell  # and
python f:/dev/3x/lib/idlelib/pyshell.py  # for instance
no longer start IDLE properly.  The separate subprocess startup command for 
when pyshell is the main, from 2004, is obsolete and no longer needed.  The 
command needed is the same as for when IDLE is started otherwise.  It works 
with either method of starting IDLE with pyshell.

In addition, two modules are created from pyshell.py, with names '__main__' and 
'idlelib.pyshell'.  The attempt to prevent this should be at the top of the 
file instead of the bottem and now needs to add 'idlelib.pyshell' instead of 
'pyshell'.  The test for this was to (temporarily) add 'print('running')' at 
the top of the file and see if 'running\n' is printed to the terminal once or 
twice.

An automated test might be done as follows:
1. Move imports in main(), including that of 'testing', to top of file.
2. Add, for instance, 'if testing: print('running') after the import.
3. Mock main().
4. Use test.support for 'with <captured stdout>: run pyshell.py'.
5. Check captured stdout for exactly one 'running' occurrence.

----------
assignee: terry.reedy
components: IDLE
messages: 338847
nosy: cheryl.sabella, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Fix starting IDLE with pyshell
type: behavior
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36429>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to