[Checkins] SVN: z3ext.formatter/trunk/ added builout for tests against zope3.4; tests updated

Nikolay Kim fafhrd at datacom.kz
Sun Nov 23 02:43:56 EST 2008


Log message for revision 93275:
  added builout for tests against zope3.4; tests updated

Changed:
  U   z3ext.formatter/trunk/buildout.cfg
  U   z3ext.formatter/trunk/setup.py
  U   z3ext.formatter/trunk/src/z3ext/formatter/README.txt
  U   z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml
  U   z3ext.formatter/trunk/src/z3ext/formatter/tests.py
  A   z3ext.formatter/trunk/tests.cfg
  A   z3ext.formatter/trunk/zope34.cfg

-=-
Modified: z3ext.formatter/trunk/buildout.cfg
===================================================================
--- z3ext.formatter/trunk/buildout.cfg	2008-11-23 07:14:55 UTC (rev 93274)
+++ z3ext.formatter/trunk/buildout.cfg	2008-11-23 07:43:56 UTC (rev 93275)
@@ -1,24 +1,8 @@
 [buildout]
 develop = .
+extends = tests.cfg
 parts = test coverage-test coverage-report i18n i18nall i18ncheck i18ndude
 
-[test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.formatter [test]
-
-
-[coverage-test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.formatter [test]
-defaults = ['--coverage', '../../coverage']
-
-
-[coverage-report]
-recipe = zc.recipe.egg
-eggs = z3c.coverage
-scripts = coverage=coverage-report
-arguments = ('coverage', 'coverage/report')
-
 [i18n]
 recipe = z3c.recipe.i18n:i18n
 packages = z3ext.formatter

Modified: z3ext.formatter/trunk/setup.py
===================================================================
--- z3ext.formatter/trunk/setup.py	2008-11-23 07:14:55 UTC (rev 93274)
+++ z3ext.formatter/trunk/setup.py	2008-11-23 07:43:56 UTC (rev 93275)
@@ -67,8 +67,7 @@
                           'zope.app.publisher',
 			  'z3c.autoinclude',
                           ],
-      extras_require = dict(test=['zope.app.zptpage',
-                                  'zope.app.testing',
+      extras_require = dict(test=['zope.app.testing',
                                   'zope.testing',
                                   'z3ext.controlpanel [test]',
                                   ]),

Modified: z3ext.formatter/trunk/src/z3ext/formatter/README.txt
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/README.txt	2008-11-23 07:14:55 UTC (rev 93274)
+++ z3ext.formatter/trunk/src/z3ext/formatter/README.txt	2008-11-23 07:43:56 UTC (rev 93275)
@@ -73,9 +73,9 @@
 DateTime formatter
 ------------------
 
-   >>> from zope.app.zptpage import ZPTPage
+   >>> from z3ext.formatter.tests import ZPTPage
    >>> page = ZPTPage()
-   >>> page.setSource(u'''
+   >>> page.pt_edit(u'''
    ... <html>
    ...   <body>
    ...     <tal:block tal:content="formatter:dateTime,short:options/now" />
@@ -84,7 +84,7 @@
    ...     <tal:block tal:content="formatter:dateTime,full:options/now" />
    ...     <tal:block tal:content="formatter:dateTime:options/now" />
    ...   </body>
-   ... </html>''')
+   ... </html>''', 'text/html')
 
    >>> dt = datetime(2007, 1, 1, 0, 0, 0, tzinfo=UTC)
    >>> dt
@@ -206,9 +206,8 @@
 
    >>> now = datetime.now(UTC)
 
-   >>> from zope.app.zptpage import ZPTPage
    >>> fpage = ZPTPage()
-   >>> fpage.setSource(u'''
+   >>> fpage.pt_edit(u'''
    ... <html>
    ...   <body>
    ...     <tal:block tal:content="formatter:fancyDatetime:options/now" />
@@ -216,7 +215,7 @@
    ...     <tal:block tal:content="formatter:fancyDatetime,medium:options/now" />
    ...     <tal:block tal:content="formatter:fancyDatetime,full:options/now" />
    ...   </body>
-   ... </html>''')
+   ... </html>''', 'text/html')
 
 Today's datetime
 
@@ -266,13 +265,13 @@
 --------------
 
    >>> datepage = ZPTPage()
-   >>> datepage.setSource(u'''
+   >>> datepage.pt_edit(u'''
    ... <html>
    ...   <body>
    ...     <tal:block tal:content="formatter:date:options/today" />
    ...     <tal:block tal:content="formatter:date,short:options/today" />
    ...   </body>
-   ... </html>''')
+   ... </html>''', 'text/html')
 
    >>> d = date(2007, 1, 1)
    >>> d
@@ -304,8 +303,8 @@
 Wrong format, we should add path expression
 
    >>> errpage = ZPTPage()
-   >>> errpage.setSource(u'''
-   ...     <tal:block tal:content="formatter:unknown" />''')
+   >>> errpage.pt_edit(u'''
+   ...     <tal:block tal:content="formatter:unknown" />''', 'text/html')
    >>> print errpage.render(request)
    Traceback (most recent call last):
    ...
@@ -314,8 +313,8 @@
 Unknown formatter
 
    >>> errpage = ZPTPage()
-   >>> errpage.setSource(u'''
-   ...     <tal:block tal:content="formatter:unknown:opitons/now" />''')
+   >>> errpage.pt_edit(u'''
+   ...     <tal:block tal:content="formatter:unknown:opitons/now" />''', 'text/html')
    >>> print errpage.render(request)
    Traceback (most recent call last):
    ...
@@ -370,10 +369,10 @@
 Now we can use formatter
 
    >>> page = ZPTPage()
-   >>> page.setSource(u'''<tal:block tal:define="value python:121.04">
+   >>> page.pt_edit(u'''<tal:block tal:define="value python:121.04">
    ... <tal:block tal:content="formatter:currency,usd:value" />
    ... <tal:block tal:content="formatter:currency,euro:value" />
-   ... </tal:block>''')
+   ... </tal:block>''', 'text/html')
 
    >>> print page.render(request)
    121.04 $

Modified: z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml	2008-11-23 07:14:55 UTC (rev 93274)
+++ z3ext.formatter/trunk/src/z3ext/formatter/configure.zcml	2008-11-23 07:43:56 UTC (rev 93275)
@@ -32,6 +32,8 @@
      xmlns:zcml="http://namespaces.zope.org/zcml"
      xmlns:browser="http://namespaces.zope.org/browser"
      zcml:condition="installed z3ext.controlpanel">
+
+    <include package="z3ext.controlpanel" file="meta.zcml" />
     <include package="z3ext.controlpanel" />
 
     <z3ext:configlet

Modified: z3ext.formatter/trunk/src/z3ext/formatter/tests.py
===================================================================
--- z3ext.formatter/trunk/src/z3ext/formatter/tests.py	2008-11-23 07:14:55 UTC (rev 93274)
+++ z3ext.formatter/trunk/src/z3ext/formatter/tests.py	2008-11-23 07:43:56 UTC (rev 93275)
@@ -23,7 +23,8 @@
 from zope.testing.cleanup import cleanUp
 from zope.app.testing import setup
 
-from zope.app.pagetemplate.engine import Engine, TrustedEngine
+from zope.pagetemplate.pagetemplate import PageTemplate
+from zope.app.pagetemplate.engine import Engine, TrustedEngine, TrustedAppPT
 from zope.app.pagetemplate.metaconfigure import clear
 
 from z3ext.controlpanel.testing import setUpControlPanel
@@ -32,6 +33,14 @@
 from z3ext.formatter.expression import FormatterExpression
 
 
+class ZPTPage(TrustedAppPT, PageTemplate):
+    
+    def render(self, request, *args, **kw):
+        namespace = self.pt_getContext(args, kw)
+        namespace['request'] = request
+        return self.pt_render(namespace)
+
+
 def setUp(test):
     setup.placefulSetUp(True)
     setup.setUpTraversal()

Added: z3ext.formatter/trunk/tests.cfg
===================================================================
--- z3ext.formatter/trunk/tests.cfg	                        (rev 0)
+++ z3ext.formatter/trunk/tests.cfg	2008-11-23 07:43:56 UTC (rev 93275)
@@ -0,0 +1,14 @@
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.formatter [test]
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.formatter [test]
+defaults = ['--coverage', '../../coverage']
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')

Added: z3ext.formatter/trunk/zope34.cfg
===================================================================
--- z3ext.formatter/trunk/zope34.cfg	                        (rev 0)
+++ z3ext.formatter/trunk/zope34.cfg	2008-11-23 07:43:56 UTC (rev 93275)
@@ -0,0 +1,9 @@
+[buildout]
+develop = .
+parts = test coverage-test coverage-report
+versions = versions
+extends = tests.cfg
+	  http://download.zope.org/zope3.4/versions-3.4.0c7.cfg
+
+[versions]
+z3c.zrtresource = 1.1.0



More information about the Checkins mailing list