Message 338847 - Python tracker (original) (raw)
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:
- Move imports in main(), including that of 'testing', to top of file.
- Add, for instance, 'if testing: print('running') after the import.
- Mock main().
- Use test.support for 'with : run pyshell.py'.
- Check captured stdout for exactly one 'running' occurrence.