Commit 18deb716 authored by Jérome Perrin's avatar Jérome Perrin

ProcessingNodeTestCase: also setRequest in processing_node

This is done on the process running test (by
ERP5TypeTestCaseRequestConnection) and when using timerserver loop (by
TimerServer which calls publish_module), but this was never set in
processing_node.

Before 3b874e49 (ERP5Type/tests: review requests in tests, 2023-04-19)
getRequest could find a request anyway, because the test pached
getRequest to find a request from the app, but after this change
executing activities in an instance running with runUnitTest without
test specified failed with:

    Module importlib, line 37, in import_module
      __import__(name)
    Module Products.ERP5Type.dynamic.component_package, line 412, in load_module
      return self.__load_module(fullname)
    Module Products.ERP5Type.dynamic.component_package, line 379, in __load_module
      erp5.component.ref_manager.add_module(module)
    Module Products.ERP5Type.dynamic.dynamic_module, line 75, in add_module
      self.add_request(get_request())
    Module Products.ERP5Type.dynamic.dynamic_module, line 53, in add_request
      self.setdefault(last_sync, (WeakSet(), set()))[0].add(request_obj)
    Module _weakrefset, line 86, in add
      self.data.add(ref(item, self._remove))
  TypeError: cannot create weak reference to 'NoneType' object

( maybe we remove processing_node and use only timerserver, these two
methods are more or less equivalent for simple cases and timerserver is
closer to what a "real" zope does )
parent 25eb8920
......@@ -6,6 +6,7 @@ from UserDict import IterableUserDict
import Lifetime
import transaction
from Testing import ZopeTestCase
from zope.globalrequest import setRequest
from ZODB.POSException import ConflictError
from zLOG import LOG, ERROR
from Products.CMFActivity.Activity.Queue import VALIDATION_ERROR_DELAY
......@@ -363,6 +364,7 @@ class ProcessingNodeTestCase(ZopeTestCase.TestCase):
def processing_node(self):
"""Main loop for nodes that process activities"""
setRequest(self.app.REQUEST)
try:
while not Lifetime._shutdown_phase:
time.sleep(.3)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment