[Python-checkins] cpython (2.7): Fixed test_tempfilepager in test_pydoc on Windows.

serhiy.storchaka python-checkins at python.org
Fri Jan 10 21:43:23 CET 2014


http://hg.python.org/cpython/rev/0e5df5b62488
changeset:   88397:0e5df5b62488
branch:      2.7
parent:      88394:3696b9ae6b17
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Fri Jan 10 22:43:03 2014 +0200
summary:
  Fixed test_tempfilepager in test_pydoc on Windows.

Filename such as r'c:\users\db3l\appdata\local\temp\tmph3vkvf' contains '\t'
which is interpreted by ast.literal_eval() as a tabulation.

files:
  Lib/test/test_pydoc.py |  5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)


diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -473,8 +473,9 @@
 
         output = {}
         def mock_system(cmd):
-            import ast
-            output['content'] = open(ast.literal_eval(cmd.strip())).read()
+            filename = cmd.strip()[1:-1]
+            self.assertEqual('"' + filename + '"', cmd.strip())
+            output['content'] = open(filename).read()
         saved, os.system = os.system, mock_system
         try:
             pydoc.tempfilepager(doc, '')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list