summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTres Seaver <tseaver@palladion.com>2012-06-07 15:04:22 +0000
committerTres Seaver <tseaver@palladion.com>2012-06-07 15:04:22 +0000
commitfdaa5c5681ad45af217fa2dbc5243f4bcb6f7bec (patch)
tree33c30366e66eaea45a8eaab24d35db34b022ca3f
parent57bfffdb751da9d133ab8425fda77e26a268b89e (diff)
downloadzope-location-fdaa5c5681ad45af217fa2dbc5243f4bcb6f7bec.tar.gz
Add Python 3.2 support.
-rw-r--r--CHANGES.txt2
-rw-r--r--setup.py2
-rw-r--r--src/zope/location/tests/test_pickling.py95
-rw-r--r--src/zope/location/traversing.py9
-rw-r--r--tox.ini36
5 files changed, 82 insertions, 62 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 9373d94..3da4163 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,8 @@ CHANGES
4.0.0 (unreleased)
------------------
+- Added Python 3.2 support.
+
- Made ``zope.component`` dependency optional. Use the ``component`` extra
to force its installation (or just require it directly). If
``zope.component`` is not present, this package defines the ``ISite``
diff --git a/setup.py b/setup.py
index d3bae27..1978ebd 100644
--- a/setup.py
+++ b/setup.py
@@ -46,6 +46,8 @@ setup(name='zope.location',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
diff --git a/src/zope/location/tests/test_pickling.py b/src/zope/location/tests/test_pickling.py
index 10b46ec..5b3c4e9 100644
--- a/src/zope/location/tests/test_pickling.py
+++ b/src/zope/location/tests/test_pickling.py
@@ -13,49 +13,54 @@
##############################################################################
import unittest
+try:
+ import zope.copy
+except ImportError:
+ def test_suite():
+ return unittest.TestSuite()
+else:
+ class LocationCopyHookTests(unittest.TestCase):
-class LocationCopyHookTests(unittest.TestCase):
-
- def _getTargetClass(self):
- from zope.location.pickling import LocationCopyHook
- return LocationCopyHook
-
- def _makeOne(self, obj=None):
- if obj is None:
- obj = object()
- return self._getTargetClass()(obj)
-
- def test_class_conforms_to_ICopyHook(self):
- from zope.interface.verify import verifyClass
- from zope.copy.interfaces import ICopyHook
- verifyClass(ICopyHook, self._getTargetClass())
-
- def test_instance_conforms_to_ICopyHook(self):
- from zope.interface.verify import verifyObject
- from zope.copy.interfaces import ICopyHook
- verifyObject(ICopyHook, self._makeOne())
-
- def test___call___w_context_inside_toplevel(self):
- from zope.copy.interfaces import ResumeCopy
- class Dummy(object):
- __parent__ = __name__ = None
- top_level = Dummy()
- context = Dummy()
- context.__parent__ = top_level
- hook = self._makeOne(context)
- self.assertRaises(ResumeCopy, hook, top_level, object())
-
- def test___call___w_context_outside_toplevel(self):
- class Dummy(object):
- __parent__ = __name__ = None
- top_level = Dummy()
- context = Dummy()
- hook = self._makeOne(context)
- self.assertTrue(hook(top_level, object()) is context)
-
-
-
-def test_suite():
- return unittest.TestSuite((
- unittest.makeSuite(LocationCopyHookTests),
- ))
+ def _getTargetClass(self):
+ from zope.location.pickling import LocationCopyHook
+ return LocationCopyHook
+
+ def _makeOne(self, obj=None):
+ if obj is None:
+ obj = object()
+ return self._getTargetClass()(obj)
+
+ def test_class_conforms_to_ICopyHook(self):
+ from zope.interface.verify import verifyClass
+ from zope.copy.interfaces import ICopyHook
+ verifyClass(ICopyHook, self._getTargetClass())
+
+ def test_instance_conforms_to_ICopyHook(self):
+ from zope.interface.verify import verifyObject
+ from zope.copy.interfaces import ICopyHook
+ verifyObject(ICopyHook, self._makeOne())
+
+ def test___call___w_context_inside_toplevel(self):
+ from zope.copy.interfaces import ResumeCopy
+ class Dummy(object):
+ __parent__ = __name__ = None
+ top_level = Dummy()
+ context = Dummy()
+ context.__parent__ = top_level
+ hook = self._makeOne(context)
+ self.assertRaises(ResumeCopy, hook, top_level, object())
+
+ def test___call___w_context_outside_toplevel(self):
+ class Dummy(object):
+ __parent__ = __name__ = None
+ top_level = Dummy()
+ context = Dummy()
+ hook = self._makeOne(context)
+ self.assertTrue(hook(top_level, object()) is context)
+
+
+
+ def test_suite():
+ return unittest.TestSuite((
+ unittest.makeSuite(LocationCopyHookTests),
+ ))
diff --git a/src/zope/location/traversing.py b/src/zope/location/traversing.py
index d6810a9..79c9812 100644
--- a/src/zope/location/traversing.py
+++ b/src/zope/location/traversing.py
@@ -20,6 +20,7 @@ from zope.interface import implementer
from zope.location.interfaces import ILocationInfo
from zope.location.interfaces import IRoot
from zope.location.interfaces import ISite # zope.component, if present
+from zope.location._compat import u
@implementer(ILocationInfo)
@@ -56,9 +57,9 @@ class LocationPhysicallyLocatable(object):
if path:
path.append('')
path.reverse()
- return u'/'.join(path)
+ return u('/'.join(path))
else:
- return u'/'
+ return u('/')
path.append(context.__name__)
context = context.__parent__
max -= 1
@@ -130,7 +131,7 @@ class RootPhysicallyLocatable(object):
def getPath(self):
"""See ILocationInfo
"""
- return u'/'
+ return u('/')
def getParent(self):
"""See ILocationInfo.
@@ -145,7 +146,7 @@ class RootPhysicallyLocatable(object):
def getName(self):
"""See ILocationInfo
"""
- return u''
+ return u('')
def getNearestSite(self):
"""See ILocationInfo
diff --git a/tox.ini b/tox.ini
index 0f5da4f..80d16c4 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,21 +11,31 @@ envlist =
commands =
python setup.py test -q
deps =
- zope.configuration
+ zope.configuration>=4.0
zope.copy
- zope.interface
- zope.proxy>3.3
- zope.schema>=3.6
+ zope.interface>=4.0
+ zope.proxy>=4.0
+ zope.schema>=4.0
[testenv:jython]
commands =
jython setup.py test -q
deps =
- zope.configuration
+ zope.configuration>=4.0
zope.copy
- zope.interface
- zope.proxy>3.3
- zope.schema>=3.6
+ zope.interface>=4.0
+ zope.proxy>=4.0
+ zope.schema>=4.0
+
+[testenv:py32]
+commands =
+ python setup.py test -q
+deps =
+ zope.configuration>=4.0
+# zope.copy>=4.0 not yet ported
+ zope.interface>=4.0
+ zope.proxy>=4.0
+ zope.schema>=4.0
[testenv:coverage]
basepython =
@@ -38,12 +48,12 @@ commands =
pip install -e .
nosetests --with-xunit --with-xcoverage
deps =
- zope.component>=3.8
- zope.configuration
+ zope.configuration>=4.0
zope.copy
- zope.interface
- zope.proxy>3.3
- zope.schema>=3.6
+ zope.interface>=4.0
+ zope.proxy>=4.0
+ zope.schema>=4.0
+ zope.component>=3.8
nose
coverage
nosexcover