[Checkins] SVN: grok/branches/ulif-testsetup-pre0.13/src/grok/testing.py Add new z3c.testsetup based implementation.

Uli Fouquet uli at gnufix.de
Wed Apr 23 10:44:10 EDT 2008


Log message for revision 85649:
  Add new z3c.testsetup based implementation.

Changed:
  U   grok/branches/ulif-testsetup-pre0.13/src/grok/testing.py

-=-
Modified: grok/branches/ulif-testsetup-pre0.13/src/grok/testing.py
===================================================================
--- grok/branches/ulif-testsetup-pre0.13/src/grok/testing.py	2008-04-23 14:41:29 UTC (rev 85648)
+++ grok/branches/ulif-testsetup-pre0.13/src/grok/testing.py	2008-04-23 14:44:09 UTC (rev 85649)
@@ -16,8 +16,27 @@
 from zope.configuration.config import ConfigurationMachine
 from martian import scan
 from grok import zcml
+import z3c.testsetup
+import os.path
 
+class GrokTestCollector(z3c.testsetup.TestCollector):
 
+    def initialize(self):
+        # inject the grok ftesting ZCML as fallback...
+        if 'zcml_config' in self.settings.keys():
+            return
+        pkg_path = os.path.dirname(self.package.__file__)
+        if os.path.isfile(os.path.join(pkg_path, 'ftesting.zcml')):
+            return
+        self.settings['zcml_config'] = os.path.join(
+            os.path.dirname(__file__), 'ftesting.zcml')
+        if 'layer_name' in self.settings.keys():
+            return
+        self.settings['layer_name'] = 'GrokFunctionalLayer'
+
+def register_all_tests(pkg, *args, **kw):
+    return GrokTestCollector(pkg, *args, **kw)
+
 def grok(module_name):
     config = ConfigurationMachine()
     zcml.do_grok('grok.meta', config)



More information about the Checkins mailing list