Exemple #1
0
class FakeReactor(object):
    """A fake threaded reactor, for testing."""
    def __init__(self):
        """Initialize a fake threaded reactor, for testing."""
        self.context = ContextTracker()

    def getThreadPool(self):
        """Return a new :class:`FakeThreadPool`."""
        return FakeThreadPool()

    def callInThread(self, f, *args, **kwargs):
        """Just call the function with the arguments."""
        self.context.callWithContext({'virtual-thread': 'non-reactor'}, f,
                                     *args, **kwargs)

    def callFromThread(self, f, *args, **kw):
        """Just call the function with the arguments."""
        self.context.callWithContext({'virtual-thread': 'reactor'}, f, *args,
                                     **kw)
Exemple #2
0
class FakeReactor(object):

    """A fake threaded reactor, for testing."""

    def __init__(self):
        """Initialize a fake threaded reactor, for testing."""
        self.context = ContextTracker()

    def getThreadPool(self):
        """Return a new :class:`FakeThreadPool`."""
        return FakeThreadPool()

    def callInThread(self, f, *args, **kwargs):
        """Just call the function with the arguments."""
        self.context.callWithContext({"virtual-thread": "non-reactor"}, f, *args, **kwargs)

    def callFromThread(self, f, *args, **kw):
        """Just call the function with the arguments."""
        self.context.callWithContext({"virtual-thread": "reactor"}, f, *args, **kw)
Exemple #3
0
 def __init__(self):
     self.context = ContextTracker()
Exemple #4
0
 def __init__(self):
     """Initialize a fake threaded reactor, for testing."""
     self.context = ContextTracker()
Exemple #5
0
 def __init__(self):
     """Initialize a fake threaded reactor, for testing."""
     self.context = ContextTracker()