[Zope3-checkins] SVN: zope.testing/tags/regebro-python3-reloaded/s Various changes for Python 3 support.

Lennart Regebro regebro at gmail.com
Mon Dec 7 13:56:39 EST 2009


Log message for revision 106253:
  Various changes for Python 3 support.
  

Changed:
  U   zope.testing/tags/regebro-python3-reloaded/setup.py
  U   zope.testing/tags/regebro-python3-reloaded/src/zope/testing/doctest.py
  U   zope.testing/tags/regebro-python3-reloaded/src/zope/testing/testrunner/options.py

-=-
Modified: zope.testing/tags/regebro-python3-reloaded/setup.py
===================================================================
--- zope.testing/tags/regebro-python3-reloaded/setup.py	2009-12-07 18:25:58 UTC (rev 106252)
+++ zope.testing/tags/regebro-python3-reloaded/setup.py	2009-12-07 18:56:38 UTC (rev 106253)
@@ -34,7 +34,7 @@
         include_package_data = True,
         zip_safe = False,
         )
-except ImportError, e:
+except ImportError:
     from distutils.core import setup
     extra = {}
 
@@ -43,7 +43,14 @@
     # Python 3 support:
     extra['use_2to3'] = True
     extra['setup_requires'] = ['zope.fixers']
-    extra['use_2to3_fixers'] = ['zope.fixers']    
+    extra['use_2to3_fixers'] = ['zope.fixers']
+    # These are only needed until zope.interface and zope.exceptions are
+    # released with Python 3 support. Copy the pre-releases into the local
+    # directory before you run setup.py under Python 3:
+    extra['install_requires'] = ['setuptools',
+                                 'zope.exceptions >= 3.6.0dev',
+                                 'zope.interface >= 3.6.0']
+    extra['dependency_links'] = ['.']
 
 from setuptools.command.test import test
 
@@ -140,7 +147,7 @@
     author='Zope Corporation and Contributors',
     author_email='zope-dev at zope.org',
 
-    packages=["zope", "zope.testing"],
+    packages=["zope", "zope.testing", "zope.testing.testrunner"],
     package_dir = {'': 'src'},
 
     classifiers=[

Modified: zope.testing/tags/regebro-python3-reloaded/src/zope/testing/doctest.py
===================================================================
--- zope.testing/tags/regebro-python3-reloaded/src/zope/testing/doctest.py	2009-12-07 18:25:58 UTC (rev 106252)
+++ zope.testing/tags/regebro-python3-reloaded/src/zope/testing/doctest.py	2009-12-07 18:56:38 UTC (rev 106253)
@@ -522,11 +522,27 @@
 
     # This lets us sort tests by name:
     def __cmp__(self, other):
+        cmp = lambda a, b: (a > b) - (a < b)
         if not isinstance(other, DocTest):
             return -1
         return cmp((self.name, self.filename, self.lineno, id(self)),
                    (other.name, other.filename, other.lineno, id(other)))
 
+    def __eq__(self, other):
+        return self.__cmp__(other) == 0
+    
+    def __neq__(self, other):
+        return self.__cmp__(other) != 0
+
+    def __lt__(self, other):
+        return self.__cmp__(other) < 0
+    
+    def __lte__(self, other):
+        return self.__cmp__(other) <= 0
+
+    def __gte__(self, other):
+        return self.__cmp__(other) >= 0
+
 ######################################################################
 ## 3. DocTestParser
 ######################################################################
@@ -2316,7 +2332,7 @@
         runner = DocTestRunner(optionflags=optionflags,
                                checker=self._dt_checker, verbose=False)
         def write(value):
-            if isinstance(value, unicode):
+            if not isinstance(value, str):
                 value = value.encode('utf8')
             new.write(value)
 

Modified: zope.testing/tags/regebro-python3-reloaded/src/zope/testing/testrunner/options.py
===================================================================
--- zope.testing/tags/regebro-python3-reloaded/src/zope/testing/testrunner/options.py	2009-12-07 18:25:58 UTC (rev 106252)
+++ zope.testing/tags/regebro-python3-reloaded/src/zope/testing/testrunner/options.py	2009-12-07 18:56:38 UTC (rev 106253)
@@ -457,6 +457,7 @@
     list_tests=False,
     slow_test_threshold=10,
     processes=1,
+    verbose=0,
     )
 
 



More information about the Zope3-Checkins mailing list