[Twisted-Python] Conch Testing server and client

exarkun at twistedmatrix.com exarkun at twistedmatrix.com
Fri Jul 1 07:21:39 MDT 2011

On 12:59 pm, anshul.singhle at gmail.com wrote:
>I understand that. The problem I'm facing is that unless I write
>"reactor.run()" my client isn't starting up. From what I understood in 
>trial documentation, I should simply call the connectTCP method and 
>return a deferred. However, if I do that, the client isn't starting. 
>post some of the client code for you info :

Complicated, incomplete code snippets aren't very useful.  Always follow 
http://sscce.org/ when sharing code.  For example:

    from twisted.trial.unittest import TestCase
    from twisted.internet.defer import Deferred
    from twisted.internet import reactor

    class ReactorIsRunningTests(TestCase):
        def test_isTheReactorRunning(self):
            d = Deferred()
            reactor.callLater(1, d.callback, None)
            return d

The output I expect from this, when run with trial, is one test method 
which takes 1 second to complete, and then succeeds.  The output I get 

        test_isTheReactorRunning ... 

    Ran 1 tests in 1.003s

    PASSED (successes=1)

In other words, it behaves as I expect.


More information about the Twisted-Python mailing list