summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-01-03 14:30:43 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-01-03 14:30:43 (GMT)
commit270fe408319ad575092efca0dcdebab9ecdba70c (patch)
tree54e58066359099215d084933d7589f812fcdcb09 /Lib/tkinter/test
parent5c85e3f390576e9ddcc2eaa714d54bf14e759f3a (diff)
downloadcpython-270fe408319ad575092efca0dcdebab9ecdba70c.zip
cpython-270fe408319ad575092efca0dcdebab9ecdba70c.tar.gz
cpython-270fe408319ad575092efca0dcdebab9ecdba70c.tar.bz2
test_tkinter: use a context manager to close directly the pipe
Patch written by Nadeem Vawda
Diffstat (limited to 'Lib/tkinter/test')
-rw-r--r--Lib/tkinter/test/test_tkinter/test_loadtk.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tkinter/test/test_tkinter/test_loadtk.py b/Lib/tkinter/test/test_tkinter/test_loadtk.py
index 8f1a085..bab7bcd 100644
--- a/Lib/tkinter/test/test_tkinter/test_loadtk.py
+++ b/Lib/tkinter/test/test_tkinter/test_loadtk.py
@@ -31,7 +31,8 @@ class TkLoadTest(unittest.TestCase):
# doesn't actually carry through to the process level
# because they don't support unsetenv
# If that's the case, abort.
- display = os.popen('echo $DISPLAY').read().strip()
+ with os.popen('echo $DISPLAY') as pipe:
+ display = pipe.read().strip()
if display:
return