[Checkins] SVN: grokproject/trunk/grokproject/template/s Replace z3c.testsetup with manual test collection. Use the browser layer from zope.fanstatic.
Jan-Jaap Driessen
jdriessen at thehealthagency.com
Mon Jan 3 04:32:12 EST 2011
Log message for revision 119285:
Replace z3c.testsetup with manual test collection. Use the browser layer from zope.fanstatic.
Changed:
U grokproject/trunk/grokproject/template/setup.py_tmpl
U grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl
U grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl
-=-
Modified: grokproject/trunk/grokproject/template/setup.py_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/setup.py_tmpl 2011-01-03 09:24:13 UTC (rev 119284)
+++ grokproject/trunk/grokproject/template/setup.py_tmpl 2011-01-03 09:32:11 UTC (rev 119285)
@@ -21,7 +21,6 @@
install_requires=['setuptools',
'grok',
'grokui.admin',
- 'z3c.testsetup',
'fanstatic',
'zope.fanstatic',
'grokcore.startup',${install_requires|nothing}
Modified: grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl 2011-01-03 09:24:13 UTC (rev 119284)
+++ grokproject/trunk/grokproject/template/src/+package+/app.txt_tmpl 2011-01-03 09:32:11 UTC (rev 119285)
@@ -1,9 +1,6 @@
Do a functional doctest test on the app.
========================================
-.. :doctest:
-.. :layer: ${package}.tests.browser_layer
-
Let's first create an instance of ${app_class_name} at the top level:
>>> from ${package}.app import ${app_class_name}
@@ -33,9 +30,9 @@
<html>
<head>
<link rel="stylesheet" type="text/css"
- href="http://localhost/fanstatic/foo/style.css" />
+ href="http://localhost/fanstatic/${project_lowercase}/style.css" />
<script type="text/javascript"
- src="http://localhost/fanstatic/foo/hello.js"></script>
+ src="http://localhost/fanstatic/${project_lowercase}/hello.js"></script>
<base href="http://localhost/app/@@index" />
<BLANKLINE>
</head>
@@ -45,7 +42,7 @@
<p>Your Grok application is up and running.
Edit <code>${package}/app_templates/index.pt</code> to change
this page.</p>
- <img src="http://localhost/fanstatic/foo/evencaveman.jpg" />
+ <img src="http://localhost/fanstatic/${project_lowercase}/evencaveman.jpg" />
</body>
</html>
<BLANKLINE>
Modified: grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl
===================================================================
--- grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl 2011-01-03 09:24:13 UTC (rev 119284)
+++ grokproject/trunk/grokproject/template/src/+package+/tests.py_tmpl 2011-01-03 09:32:11 UTC (rev 119285)
@@ -1,15 +1,18 @@
-import os.path
-import z3c.testsetup
-from zope.app.wsgi.testlayer import BrowserLayer
-import fanstatic
+import unittest
+import doctest
+from zope.fanstatic.testing import ZopeFanstaticBrowserLayer
+
import ${package}
-class FanstaticLayer(BrowserLayer):
- def setup_middleware(self, app):
- return fanstatic.Fanstatic(app)
+browser_layer = ZopeFanstaticBrowserLayer(${package})
-browser_layer = FanstaticLayer(${package})
+def test_suite():
+ suite = unittest.TestSuite()
-test_suite = z3c.testsetup.register_all_tests(
- '${package}', globs={'getRootFolder': browser_layer.getRootFolder})
+ app_test = doctest.DocFileSuite('app.txt',
+ globs={'getRootFolder': browser_layer.getRootFolder})
+ app_test.layer = browser_layer
+
+ suite.addTest(app_test)
+ return suite
More information about the checkins
mailing list