Opened 12 years ago

Last modified 5 years ago

#1523 defect new

trial bombs completely when a test method calls reactor.stop()

Reported by: Jean-Paul Calderone Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:


Here's a test case which triggers this:

from twisted.trial import unittest
from twisted.internet import reactor, defer

class ReactoStopTestCase(unittest.TestCase):
    def testReactorStop(self):
        reactor.callLater(1, lambda: reactor.stop())
        return defer.Deferred()

Here's the output I get:

exarkun@kunai:~$ trial 
Running 1 tests.
    testReactorStop ...     cleanup errors                                           [ERROR]

/home/exarkun/Projects/Twisted/trunk/twisted/trial/ twisted.trial.reporter.BrokenTestCaseWarning: REACTOR UNCLEAN! traceback(s) follow: 
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 101, in _dispatch
    getattr(self, "do_%s" % attr)()
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 128, in do_cleanPending
    raise PendingTimedCallsError(s)
twisted.trial.util.PendingTimedCallsError: pendingTimedCalls still pending (consider setting twisted.internet.base.DelayedCall.debug = True): <DelayedCall -1216885332 [118.999278069s] called=0 cancelled=0 onTimeout(<Deferred at 0xB777CD8CL>)>

Traceback (most recent call last):
  File "/home/exarkun/Projects/Twisted/trunk/bin/trial", line 24, in ?
  File "/home/exarkun/Projects/Twisted/trunk/twisted/scripts/", line 373, in run
    test_result =
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 472, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 179, in run, result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 119, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 111, in __call__
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 119, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 111, in __call__
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 119, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 111, in __call__
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 119, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 343, in __call__
    return*args, **kwargs)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 477, in run
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/", line 593, in _wait
    raise KeyboardInterrupt()

Note that this is without ever hitting C.

Change History (5)

comment:1 Changed 12 years ago by Jonathan Lange

Status: newassigned

It'd really help if you could describe what you expect to see instead.

comment:2 Changed 11 years ago by Jonathan Lange

Status: assignednew

comment:3 Changed 11 years ago by Jean-Paul Calderone

The important missing information is the test run summary. Since calling reactor.stop() in a test method is deprecated now and will presumably begin raising an exception at some future point, I would expect the test which does this to at least incur an error in the final report. The important point is that the final report must be made, even if there is a test which is buggy in this manner.

comment:4 Changed 7 years ago by <automation>

Owner: Jonathan Lange deleted

comment:5 Changed 5 years ago by Julian Berman

Think this should be handled partially when #1334 is done.

Note: See TracTickets for help on using tickets.