[Checkins] SVN: zope.browserresource/trunk/ Ported to Python 3.3, added tox.ini and MANIFEST.in.

Albertas Agejevas cvs-admin at zope.org
Wed Feb 20 13:50:42 UTC 2013


Log message for revision 129529:
  Ported to Python 3.3, added tox.ini and MANIFEST.in.
  

Changed:
  A   zope.browserresource/trunk/MANIFEST.in
  U   zope.browserresource/trunk/setup.py
  U   zope.browserresource/trunk/src/zope/browserresource/file.py
  U   zope.browserresource/trunk/src/zope/browserresource/tests/test_directives.py
  U   zope.browserresource/trunk/src/zope/browserresource/tests/test_file.py
  U   zope.browserresource/trunk/src/zope/browserresource/tests/test_icondirective.py
  U   zope.browserresource/trunk/src/zope/browserresource/tests/test_resources.py
  A   zope.browserresource/trunk/tox.ini

-=-
Added: zope.browserresource/trunk/MANIFEST.in
===================================================================
--- zope.browserresource/trunk/MANIFEST.in	                        (rev 0)
+++ zope.browserresource/trunk/MANIFEST.in	2013-02-20 13:50:41 UTC (rev 129529)
@@ -0,0 +1,9 @@
+include *.rst
+include *.txt
+include tox.ini
+include bootstrap.py
+include buildout.cfg
+
+recursive-include src *
+
+global-exclude *.pyc


Property changes on: zope.browserresource/trunk/MANIFEST.in
___________________________________________________________________
Added: svn:keywords
   + Id

Modified: zope.browserresource/trunk/setup.py
===================================================================
--- zope.browserresource/trunk/setup.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/setup.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -13,8 +13,26 @@
 ##############################################################################
 """zope.browserresource setup
 """
+import os
+import sys
 from setuptools import setup, find_packages
 
+
+def test_suite():
+    # use the zope.testrunner machinery to find all the
+    # test suites we've put under ourselves
+    from zope.testrunner.options import get_options
+    from zope.testrunner.find import find_suites
+    from unittest import TestSuite
+    here = os.path.abspath(os.path.dirname(sys.argv[0]))
+    args = sys.argv[:]
+    src = os.path.join(here, 'src')
+    defaults = ['--test-path', src]
+    options = get_options(args, defaults)
+    suites = list(find_suites(options))
+    return TestSuite(suites)
+
+
 long_description = (open('README.txt').read() + '\n\n' +
                     open('CHANGES.txt').read())
 
@@ -39,13 +57,14 @@
       license='ZPL 2.1',
       packages=find_packages('src'),
       package_dir={'': 'src'},
+      test_suite='__main__.test_suite',
 
       namespace_packages=['zope'],
       include_package_data=True,
       install_requires=['setuptools',
                         'zope.component>=3.8.0',
                         'zope.configuration',
-                        'zope.contenttype',
+                        'zope.contenttype>=4.0.1',
                         'zope.i18n',
                         'zope.interface',
                         'zope.location',

Modified: zope.browserresource/trunk/src/zope/browserresource/file.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/file.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/src/zope/browserresource/file.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -219,13 +219,13 @@
             # understand the screwy date string as a lucky side effect
             # of the way they parse it).
             try:
-                mod_since = long(mktime_tz(parsedate_tz(header)))
-            except:
+                mod_since = int(mktime_tz(parsedate_tz(header)))
+            except (ValueError, TypeError):
                 mod_since = None
             if getattr(file, 'lmt', None):
-                last_mod = long(file.lmt)
+                last_mod = int(file.lmt)
             else:
-                last_mod = 0L
+                last_mod = 0
             if mod_since is None or last_mod <= 0 or last_mod > mod_since:
                 all_cache_checks_passed = False
 

Modified: zope.browserresource/trunk/src/zope/browserresource/tests/test_directives.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/tests/test_directives.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/src/zope/browserresource/tests/test_directives.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -16,8 +16,10 @@
 
 import os
 import unittest
-from cStringIO import StringIO
-
+try:
+    from cStringIO import StringIO
+except ImportError:
+    from io import StringIO
 from zope import component
 from zope.interface import Interface, implements, directlyProvides, providedBy
 

Modified: zope.browserresource/trunk/src/zope/browserresource/tests/test_file.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/tests/test_file.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/src/zope/browserresource/tests/test_file.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -16,6 +16,7 @@
 
 import doctest
 import os
+import re
 import unittest
 import time
 try:
@@ -24,6 +25,7 @@
     from email.Utils import formatdate, parsedate_tz, mktime_tz
 
 from zope.testing import cleanup
+from zope.testing.renormalizing import RENormalizing
 from zope.publisher.browser import TestRequest
 from zope.publisher.interfaces.browser import IBrowserRequest
 from zope.security.checker import NamesChecker
@@ -279,10 +281,17 @@
 
 
 def test_suite():
+    checker = RENormalizing([
+        # Python 3 includes module name in exceptions
+        (re.compile(r"zope.publisher.interfaces.NotFound"),
+         "NotFound"),
+    ])
+
     return unittest.TestSuite((
         doctest.DocTestSuite(
             'zope.browserresource.file',
             setUp=setUp, tearDown=tearDown,
+            checker=checker,
             optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE),
         doctest.DocTestSuite(
             setUp=setUp, tearDown=tearDown,

Modified: zope.browserresource/trunk/src/zope/browserresource/tests/test_icondirective.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/tests/test_icondirective.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/src/zope/browserresource/tests/test_icondirective.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -14,7 +14,10 @@
 """Test Icon-Directive
 """
 import os
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 from unittest import TestCase, main, makeSuite
 
 from zope import component

Modified: zope.browserresource/trunk/src/zope/browserresource/tests/test_resources.py
===================================================================
--- zope.browserresource/trunk/src/zope/browserresource/tests/test_resources.py	2013-02-20 13:37:37 UTC (rev 129528)
+++ zope.browserresource/trunk/src/zope/browserresource/tests/test_resources.py	2013-02-20 13:50:41 UTC (rev 129529)
@@ -14,9 +14,11 @@
 """Test Browser Resources
 """
 
+import re
 import doctest
 import unittest
 from zope.testing import cleanup
+from zope.testing.renormalizing import RENormalizing
 
 def setUp(test):
     cleanup.setUp()
@@ -25,9 +27,15 @@
     cleanup.tearDown()
 
 def test_suite():
+    checker = RENormalizing([
+        # Python 3 includes module name in exceptions
+        (re.compile(r"zope.publisher.interfaces.NotFound"),
+         "NotFound"),
+    ])
     return unittest.TestSuite((
         doctest.DocTestSuite(
             'zope.browserresource.resources',
             setUp=setUp, tearDown=tearDown,
+            checker=checker,
             optionflags=doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE),
         ))

Added: zope.browserresource/trunk/tox.ini
===================================================================
--- zope.browserresource/trunk/tox.ini	                        (rev 0)
+++ zope.browserresource/trunk/tox.ini	2013-02-20 13:50:41 UTC (rev 129529)
@@ -0,0 +1,8 @@
+[tox]
+envlist = py26,py27,py33
+
+[testenv]
+commands = python setup.py test -q
+deps =
+    zope.testrunner
+    zope.testing


Property changes on: zope.browserresource/trunk/tox.ini
___________________________________________________________________
Added: svn:keywords
   + Id



More information about the checkins mailing list