Ejemplo n.º 1
0
 def testDelayedGetWithTimeoutThenClosed(self, maxsize=1):
     r"""
     @summary: Test what happens to a q.get(block=True, timeout=lots)
     when the socket is remotely closed.
     """
     iface = PyRQIface(quiet=self.quiet, ref="creator-testDelayedGetWithTimeoutThenClosed")
     namespace = iface.create(maxsize=maxsize)
     self._closeQueue(namespace, delay=1, name="closer-testDelayedGetWithTimeoutThenClosed")
     iface = PyRQIface(namespace=namespace, quiet=self.quiet, ref="testDelayedGetWithTimeoutThenClosed")
     try:
         iface.get(block=True, timeout=10)
     except (ClosedError, Empty):
         assert True
     else:
         assert False
Ejemplo n.º 2
0
 def testNonBlockingGet(self):
     self.namespace = self._createInterface()
     iface = PyRQIface(ref="testNonBlockingGet", namespace=self.namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     try:
         _data = iface.get(block=False, timeout=None)
     except Empty, _e:
         assert True
Ejemplo n.º 3
0
        def doGet(initialDelay, ref, getTimeout):
            time.sleep(initialDelay)
            self.logger.debug("GET %(R)s START"%{"R":ref})
            iface = PyRQIface(namespace=self.namespace, quiet=self.quiet, ref="get.%(R)s"%{"R":ref}, loggingModule=testLoggingModule)
            while self.timerTerminate==0:
                try:
                    data = iface.get(block=True, timeout=min(1, min(1, getTimeout)))
                except Empty, data:
                    continue
                except Exception, _e:
#                    self.logger.error("GET %(R)s EXCEPTION: %(E)s"%{"R":ref, "E":_e})
                    continue
Ejemplo n.º 4
0
 def doGet(initialDelay, ref, getTimeout):
     time.sleep(initialDelay)
     iface = PyRQIface(ref="get.%(R)s"%{"R":ref}, namespace=namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     while self.timerTerminate==0:
         rtn = False
         try:
             data = iface.get(timeout=getTimeout)
         except Empty, data:
             rtn = True
         with l:
             eGets.append(data)
         if rtn:
             return
Ejemplo n.º 5
0
     self.iface.close(timeout=100000)
     #    Now attempt a PUT:
     iface = PyRQIface(ref="testPostCloseDifferentIface.0", namespace=self.namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     try:
         iface.put(eData, block=block, timeout=timeout)
     except ClosedError, _e:
         assert True
     else:
         assert False
     finally:
         try:    iface.close()
         except: pass
     #    Now attempt a GET:
     iface = PyRQIface(ref="testPostCloseDifferentIface.1", namespace=self.namespace, quiet=self.quiet, loggingModule=testLoggingModule)
     try:
         iface.get(block=block, timeout=timeout)
     except ClosedError, _e:
         assert True
     else:
         assert False
     finally:
         try:    iface.close()
         except: pass
 def testCloseDuringGet(self):
     self.testCreate()
     def close(namespace):
         iface = PyRQIface(ref="testCloseDuringGet", namespace=namespace, quiet=self.quiet, loggingModule=testLoggingModule)
         iface.close()
     threading.Timer(0, close, args=[self.namespace]).start()
     try:
         self.iface.get(block=True, timeout=None)