Phillip J. Eby wrote:
> Can you send or point me to the test app in question?  The default
> reactor normally disables Ctrl-C (but the testreactor won't, as long as
> you never call reactor.run() directly), but an infinite loop should only
> happen if you don't have anything running that will stop the reactor.

Ok, so that explains the Ctrl+C. And I am not 100% sure it's infinite
loop, but I did wait several minutes (takes less than a minute to run
all the tests normally).

>> > reactor.waitFor(deferred, timeout) -- iterate until the deferred
>>
>> Since I haven't needed to use deferred's in my trivial test cases I'd
>> need to figure out how to call this.
>
> Well, if all you want to do is have some code do something and then stop
> the reactor, I could make two methods: reactor.waitFor(seconds) and
> reactor.waitUntil(deferred,timeout).  Then, you could just call
> waitFor() and let your tests do reactor.stop() when done.
>
> By the way, if you are doing assertions in code that is called by the
> reactor, this may be a bit of a problem; the reactor expects to log all
> such errors, and doesn't pass them on anywhere.  So, you would
> definitely need for all your assertions to be in your test method itself
> (i.e. *after* the waitFor/waitUntil)

Uh oh. Well that could be a problem. Unit tests typically want to do
lots of asserts all over the place.

Here are the M2Crypto SSL tests that currently run one unit tests where
twisted reactor is started and stopped. If I copy the
test_twisted_wrapper() method and rename the new to to, say
test_twisted_wrapper2, then I get the problems I mentioned above.

How would you see this file would need to change to run two tests with
twisted in it?

http://lxr.osafoundation.org/m2crypto/source/tests/test_ssl.py

--
  Heikki Toivonen

Attachment: signature.asc
Description: OpenPGP digital signature

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev

Reply via email to