changeset 3944:a86a245db9cb

Backed out changeset 28442c70f757, it introduced the idea to create the request more often. I could not reproduce any test failures related to the old situation. Thus I revert this changeset again. The changes in the PageEditor tests will be reapplied in my next commit.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Fri, 15 Aug 2008 23:20:11 +0200
parents 28442c70f757
children 3a6be2089de9
files MoinMoin/_tests/test_PageEditor.py MoinMoin/conftest.py
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_PageEditor.py	Sun Aug 10 02:18:10 2008 +0200
+++ b/MoinMoin/_tests/test_PageEditor.py	Fri Aug 15 23:20:11 2008 +0200
@@ -210,7 +210,6 @@
         """
         simple test if it is possible to delete a Dict page after creation
         """
-        become_trusted(self.request)
         pagename = u'SomeDict'
         page = PageEditor(self.request, pagename, do_editor_backup=0)
         body = u"This is an example text"
--- a/MoinMoin/conftest.py	Sun Aug 10 02:18:10 2008 +0200
+++ b/MoinMoin/conftest.py	Fri Aug 15 23:20:11 2008 +0200
@@ -170,9 +170,9 @@
 
 class MoinTestFunction(py.test.collect.Function):
     def execute(self, target, *args):
+        request = self.parent.request
         co = target.func_code
         if 'request' in co.co_varnames[:co.co_argcount]:
-            request = init_test_request()
             target(request, *args)
         else:
             target(*args)
@@ -183,9 +183,8 @@
 
     def setup(self):
         cls = self.obj
-        if not hasattr(cls, 'request'):
-            cls.request = init_test_request()
-            cls.TestConfig = TestConfig(cls.request)
+        cls.request = self.parent.request
+        cls.TestConfig = TestConfig(cls.request)
         super(MoinClassCollector, self).setup()
 
 
@@ -193,6 +192,10 @@
     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', []))