[Zope-Checkins] SVN: Zope/branches/gsoc-python-2.5/lib/python/Products/PythonScripts/tests/testPythonScript.py - This test fails with a TypeError on Python 2.6, so adjust accordingly.

Sidnei da Silva sidnei at enfoldsystems.com
Tue Oct 7 23:53:23 EDT 2008


Log message for revision 91891:
  - This test fails with a TypeError on Python 2.6, so adjust accordingly.
  
  

Changed:
  U   Zope/branches/gsoc-python-2.5/lib/python/Products/PythonScripts/tests/testPythonScript.py

-=-
Modified: Zope/branches/gsoc-python-2.5/lib/python/Products/PythonScripts/tests/testPythonScript.py
===================================================================
--- Zope/branches/gsoc-python-2.5/lib/python/Products/PythonScripts/tests/testPythonScript.py	2008-10-08 01:14:02 UTC (rev 91890)
+++ Zope/branches/gsoc-python-2.5/lib/python/Products/PythonScripts/tests/testPythonScript.py	2008-10-08 03:53:21 UTC (rev 91891)
@@ -10,7 +10,7 @@
 # FOR A PARTICULAR PURPOSE
 #
 ##############################################################################
-import os, unittest, warnings
+import os, sys, unittest, warnings
 
 from Products.PythonScripts.PythonScript import PythonScript
 from AccessControl.SecurityManagement import newSecurityManager
@@ -288,13 +288,19 @@
         f = self._filePS('class.__name__')
         self.assertEqual(f(), ("'foo'>", "'string'"))
 
-    def test_filepath(self):
-        # This test is meant to raise a deprecation warning.
-        # It used to fail mysteriously instead.
-        self._trap_warning_output()
-        f = self._filePS('filepath')
-        self.assertEqual(f(), [0])
-        self._free_warning_output()
+    if sys.version_info < (2, 6):
+        def test_filepath(self):
+            # This test is meant to raise a deprecation warning.
+            # It used to fail mysteriously instead.
+            self._trap_warning_output()
+            f = self._filePS('filepath')
+            self.assertEqual(f(), [0])
+            self._free_warning_output()
+    else:
+        def test_filepath(self):
+            # On Python 2.6, this now raises a TypeError.
+            f = self._filePS('filepath')
+            self.assertRaises(TypeError, f)
 
 class PythonScriptInterfaceConformanceTests(unittest.TestCase):
 



More information about the Zope-Checkins mailing list