This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients terry.reedy
Date 2016-08-30.02:27:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1472524024.9.0.822117850837.issue27892@psf.upfronthosting.co.za>
In-reply-to
Content
Another good reason for delaying an import is when the import is only needed for testing.

In module_x
...
def callable_x(parent)  # htest #
    from tkinter import Toplevel
    box = Toplevel(parent)
    ...
if __name__ == '__main__':
    from unittest import main
    main('idlelib.idle_test.test_module_x', verbosity=2)

    from idlelib.idle_test.htest import run
    run(callable_x)

This should be part of 'Import Standards' in idlelib.README.
History
Date User Action Args
2016-08-30 02:27:04terry.reedysetrecipients: + terry.reedy
2016-08-30 02:27:04terry.reedysetmessageid: <1472524024.9.0.822117850837.issue27892@psf.upfronthosting.co.za>
2016-08-30 02:27:04terry.reedylinkissue27892 messages
2016-08-30 02:27:04terry.reedycreate