[Checkins] SVN: zope.copy/trunk/ Add support for continuous integration using 'tox' and 'jenkins'.
Tres Seaver
cvs-admin at zope.org
Wed Jun 13 15:23:46 UTC 2012
Log message for revision 126850:
Add support for continuous integration using 'tox' and 'jenkins'.
Changed:
_U zope.copy/trunk/
U zope.copy/trunk/CHANGES.txt
U zope.copy/trunk/setup.py
U zope.copy/trunk/src/zope/copy/examples.py
U zope.copy/trunk/src/zope/copy/tests/test_copy.py
A zope.copy/trunk/tox.ini
-=-
Modified: zope.copy/trunk/CHANGES.txt
===================================================================
--- zope.copy/trunk/CHANGES.txt 2012-06-13 15:23:38 UTC (rev 126849)
+++ zope.copy/trunk/CHANGES.txt 2012-06-13 15:23:42 UTC (rev 126850)
@@ -5,6 +5,8 @@
4.0.0 (unreleased)
------------------
+- Added support for continuous integration using ``tox`` and ``jenkins``.
+
- Added Sphinx documentation: moved doctest examples to API reference.
- Added 'setup.py docs' alias (installs ``Sphinx`` and dependencies).
Modified: zope.copy/trunk/setup.py
===================================================================
--- zope.copy/trunk/setup.py 2012-06-13 15:23:38 UTC (rev 126849)
+++ zope.copy/trunk/setup.py 2012-06-13 15:23:42 UTC (rev 126850)
@@ -59,6 +59,7 @@
],
include_package_data = True,
zip_safe = False,
+ test_suite='zope.copy.tests',
extras_require={
'test': TESTS_REQUIRE,
'testing': TESTS_REQUIRE + ['nose', 'coverage'],
Modified: zope.copy/trunk/src/zope/copy/examples.py
===================================================================
--- zope.copy/trunk/src/zope/copy/examples.py 2012-06-13 15:23:38 UTC (rev 126849)
+++ zope.copy/trunk/src/zope/copy/examples.py 2012-06-13 15:23:42 UTC (rev 126850)
@@ -15,7 +15,7 @@
"""
import zope.location.location
-class Demo(object):
+class Demo(object): #pragma NO COVER
_frozen = None
@@ -26,11 +26,11 @@
self._frozen = Data()
-class Data(object):
+class Data(object): #pragma NO COVER
pass
-class Subobject(zope.location.location.Location):
+class Subobject(zope.location.location.Location): #pragma NO COVER
def __init__(self):
self.counter = 0
@@ -41,14 +41,14 @@
return res
-class Something(object):
+class Something(object): #pragma NO COVER
pass
root = object()
-class Other(object):
+class Other(object): #pragma NO COVER
@apply
def __name__():
def fget(self):
Modified: zope.copy/trunk/src/zope/copy/tests/test_copy.py
===================================================================
--- zope.copy/trunk/src/zope/copy/tests/test_copy.py 2012-06-13 15:23:38 UTC (rev 126849)
+++ zope.copy/trunk/src/zope/copy/tests/test_copy.py 2012-06-13 15:23:42 UTC (rev 126850)
@@ -13,7 +13,94 @@
##############################################################################
import unittest
+class Test_copy(unittest.TestCase):
+ def setUp(self):
+ from zope.component.globalregistry import base
+ base.__init__('base') # blow away previous registrations
+ tearDown = setUp
+
+ def _callFUT(self, obj):
+ from zope.copy import copy
+ return copy(obj)
+
+ def test_wo_hooks(self):
+ from zope.copy.examples import Demo
+ demo = Demo()
+ demo.freeze()
+ self.assertTrue(demo.isFrozen())
+ copied = self._callFUT(demo)
+ self.assertFalse(copied is demo)
+ self.assertTrue(isinstance(copied, Demo))
+ self.assertTrue(copied.isFrozen())
+
+ def test_w_simple_hook(self):
+ from zope.component import provideAdapter
+ from zope.interface import implementer
+ from zope.copy.interfaces import ICopyHook
+ from zope.copy.examples import Data
+ from zope.copy.examples import Demo
+ demo = Demo()
+ demo.freeze()
+ def _factory(obj, register):
+ return None
+ @implementer(ICopyHook)
+ def data_copyfactory(obj):
+ return _factory
+ provideAdapter(data_copyfactory, (Data,))
+ copied = self._callFUT(demo)
+ self.assertFalse(copied is demo)
+ self.assertTrue(isinstance(copied, Demo))
+ self.assertFalse(copied.isFrozen())
+
+ def test_subobject_wo_post_copy_hook(self):
+ from zope.location.location import Location
+ from zope.location.location import locate
+ from zope.copy.examples import Subobject
+ o = Location()
+ s = Subobject()
+ o.subobject = s
+ locate(s, o, 'subobject')
+ self.assertTrue(s.__parent__ is o)
+ self.assertEqual(o.subobject(), 0)
+ self.assertEqual(o.subobject(), 1)
+ self.assertEqual(o.subobject(), 2)
+ c = self._callFUT(o)
+ self.assertTrue(c.subobject.__parent__ is c)
+ self.assertEqual(c.subobject(), 3)
+ self.assertEqual(o.subobject(), 3)
+
+ def test_subobject_w_post_copy_hook(self):
+ from zope.component import provideAdapter
+ from zope.interface import implementer
+ from zope.copy.interfaces import ICopyHook
+ from zope.location.location import Location
+ from zope.location.location import locate
+ from zope.copy.examples import Subobject
+ o = Location()
+ s = Subobject()
+ o.subobject = s
+ locate(s, o, 'subobject')
+ self.assertTrue(s.__parent__ is o)
+ self.assertEqual(o.subobject(), 0)
+ self.assertEqual(o.subobject(), 1)
+ self.assertEqual(o.subobject(), 2)
+ @implementer(ICopyHook)
+ def subobject_copyfactory(original):
+ def factory(obj, register):
+ obj = Subobject()
+ def reparent(translate):
+ obj.__parent__ = translate(original.__parent__)
+ register(reparent)
+ return obj
+ return factory
+ provideAdapter(subobject_copyfactory, (Subobject,))
+ c = self._callFUT(o)
+ self.assertTrue(c.subobject.__parent__ is c)
+ self.assertEqual(c.subobject(), 0)
+ self.assertEqual(o.subobject(), 3)
+
def test_suite():
return unittest.TestSuite((
+ unittest.makeSuite(Test_copy),
))
Added: zope.copy/trunk/tox.ini
===================================================================
--- zope.copy/trunk/tox.ini (rev 0)
+++ zope.copy/trunk/tox.ini 2012-06-13 15:23:42 UTC (rev 126850)
@@ -0,0 +1,50 @@
+[tox]
+envlist =
+# Jython support pending 2.7 support, due 2012-07-15 or so. See:
+# http://fwierzbicki.blogspot.com/2012/03/adconion-to-fund-jython-27.html
+# py26,py27,py32,pypy,jython,coverage
+# py26,py27,py32,pypy,coverage,docs
+ py26,py27,coverage,docs
+
+[testenv]
+commands =
+ python setup.py test -q
+deps =
+ zope.interface
+ zope.component
+ zope.location
+
+[testenv:jython]
+commands =
+ jython setup.py test -q
+
+[testenv:coverage]
+basepython =
+ python2.6
+commands =
+# The installed version messes up nose's test discovery / coverage reporting
+# So, we uninstall that from the environment, and then install the editable
+# version, before running nosetests.
+ pip uninstall -y zope.copy
+ pip install -e .
+ nosetests --with-xunit --with-xcoverage
+deps =
+ zope.interface
+ zope.component
+ zope.location
+ nose
+ coverage
+ nosexcover
+
+[testenv:docs]
+basepython =
+ python2.6
+commands =
+ sphinx-build -b html -d docs/_build/doctrees docs docs/_build/html
+ sphinx-build -b doctest -d docs/_build/doctrees docs docs/_build/doctest
+deps =
+ Sphinx
+ repoze.sphinx.autointerface
+ zope.interface
+ zope.component
+ zope.location
More information about the checkins
mailing list