aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_pipes.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_pipes.py')
-rw-r--r--Lib/test/test_pipes.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/test/test_pipes.py b/Lib/test/test_pipes.py
index c8b8be106c2..d5b886f87ef 100644
--- a/Lib/test/test_pipes.py
+++ b/Lib/test/test_pipes.py
@@ -2,7 +2,7 @@ import pipes
import os
import string
import unittest
-from test.test_support import TESTFN, run_unittest, unlink, reap_children
+from test.support import TESTFN, run_unittest, unlink, reap_children
if os.name != 'posix':
raise unittest.SkipTest('pipes module only works on posix')
@@ -40,8 +40,11 @@ class SimplePipeTests(unittest.TestCase):
f.write('hello world #2')
t = pipes.Template()
t.append(s_command + ' < $IN', pipes.FILEIN_STDOUT)
- with t.open(TESTFN, 'r') as f:
+ f = t.open(TESTFN, 'r')
+ try:
self.assertEqual(f.read(), 'HELLO WORLD #2')
+ finally:
+ f.close()
def testEmptyPipeline1(self):
# copy through empty pipe
@@ -61,8 +64,11 @@ class SimplePipeTests(unittest.TestCase):
with open(TESTFN, 'w') as f:
f.write(d)
t=pipes.Template()
- with t.open(TESTFN, 'r') as f:
+ f = t.open(TESTFN, 'r')
+ try:
self.assertEqual(f.read(), d)
+ finally:
+ f.close()
def testEmptyPipeline3(self):
# write through empty pipe
@@ -75,7 +81,8 @@ class SimplePipeTests(unittest.TestCase):
def testQuoting(self):
safeunquoted = string.ascii_letters + string.digits + '@%_-+=:,./'
- unsafe = '"`$\\!'
+ unicode_sample = '\xe9\xe0\xdf' # e + acute accent, a + grave, sharp s
+ unsafe = '"`$\\!' + unicode_sample
self.assertEqual(pipes.quote(''), "''")
self.assertEqual(pipes.quote(safeunquoted), safeunquoted)