changeset 2280:27cd29db1b96

Fix conftest to allow generative tests.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Mon, 02 Jul 2007 18:43:52 +0200
parents 938d6761519f
children bb9853b194f7
files MoinMoin/conftest.py
diffstat 1 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/conftest.py	Mon Jul 02 17:05:40 2007 +0200
+++ b/MoinMoin/conftest.py	Mon Jul 02 18:43:52 2007 +0200
@@ -162,23 +162,8 @@
     __del__ = restore # XXX __del__ semantics are currently broken
 
 
-class Module(py.test.collect.Module):
-    def __init__(self, *args, **kwargs):
-        self.request = init_test_request()
-        super(Module, self).__init__(*args, **kwargs)
 
-    def run(self, *args, **kwargs):
-        if coverage is not None:
-            coverage_modules.update(getattr(self.obj, 'coverage_modules', []))
-        return super(Module, self).run(*args, **kwargs)
-
-    def join(self, name):
-        obj = getattr(self.obj, name)
-        if isclass(obj):
-            return MoinClassCollector(name, parent=self)
-        elif hasattr(obj, 'func_code'):
-            return MoinTestFunction(name, parent=self)
-
+# py.test customization starts here
 
 class MoinTestFunction(py.test.collect.Function):
     def execute(self, target, *args):
@@ -198,3 +183,18 @@
         cls.request = self.parent.request
         cls.TestConfig = TestConfig(cls.request)
         super(MoinClassCollector, self).setup()
+
+
+class Module(py.test.collect.Module):
+    Class = MoinClassCollector
+    Function = MoinTestFunction
+
+    def __init__(self, *args, **kwargs):
+        self.request = init_test_request()
+        super(Module, self).__init__(*args, **kwargs)
+
+    def run(self, *args, **kwargs):
+        if coverage is not None:
+            coverage_modules.update(getattr(self.obj, 'coverage_modules', []))
+        return super(Module, self).run(*args, **kwargs)
+