[Python-checkins] cpython (2.7): Issue #27918# test.resource.is_gui_available no longer flashes tk window.
terry.reedy
python-checkins at python.org
Mon Sep 5 00:02:05 EDT 2016
https://hg.python.org/cpython/rev/de9e410e78d8
changeset: 103035:de9e410e78d8
branch: 2.7
user: Terry Jan Reedy <tjreedy at udel.edu>
date: Mon Sep 05 00:01:28 2016 -0400
summary:
Issue #27918# test.resource.is_gui_available no longer flashes tk window.
Also, don't run it if 'gui' is not requested. Patch by Xiang Zhang.
files:
Lib/test/test_support.py | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -331,6 +331,7 @@
try:
from Tkinter import Tk
root = Tk()
+ root.withdraw()
root.update()
root.destroy()
except Exception as e:
@@ -355,12 +356,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 `%s' resource not enabled" % resource
raise ResourceDenied(msg)
+ if resource == 'gui' and not _is_gui_available():
+ raise ResourceDenied(_is_gui_available.reason)
def requires_mac_ver(*min_version):
"""Decorator raising SkipTest if the OS is Mac OS X and the OS X
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list