diff -r fc711879c64a Lib/test/support/__init__.py --- a/Lib/test/support/__init__.py Wed Aug 31 21:09:02 2016 -0400 +++ b/Lib/test/support/__init__.py Thu Sep 01 15:02:42 2016 +0800 @@ -466,6 +466,7 @@ try: from tkinter import Tk root = Tk() + root.withdraw() root.update() root.destroy() except Exception as e: @@ -490,12 +491,12 @@ def requires(resource, msg=None): """Raise ResourceDenied if the specified resource is not available.""" - if resource == 'gui' and not _is_gui_available(): - raise ResourceDenied(_is_gui_available.reason) if not is_resource_enabled(resource): if msg is None: msg = "Use of the %r resource not enabled" % resource raise ResourceDenied(msg) + if resource == 'gui' and not _is_gui_available(): + raise ResourceDenied(_is_gui_available.reason) def _requires_unix_version(sysname, min_version): """Decorator raising SkipTest if the OS is `sysname` and the version is less