Opened 11 years ago

Last modified 3 years ago

#1523 defect new

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

Reported by: exarkun Owned by:
Priority: normal Milestone:
Component: trial Keywords:
Cc: Branch:
Author:

Description

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 test_reactorstop.py 
Running 1 tests.
test_reactorstop
  ReactoStopTestCase
    testReactorStop ...     cleanup errors                                           [ERROR]

/home/exarkun/Projects/Twisted/trunk/twisted/trial/reporter.py:154: twisted.trial.reporter.BrokenTestCaseWarning: REACTOR UNCLEAN! traceback(s) follow: 
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/util.py", line 101, in _dispatch
    getattr(self, "do_%s" % attr)()
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/util.py", 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 ?
    run()
  File "/home/exarkun/Projects/Twisted/trunk/twisted/scripts/trial.py", line 373, in run
    test_result = trialRunner.run(suite)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 472, in run
    suite.run(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 179, in run
    TestSuite.run(self, result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 119, in run
    test(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 111, in __call__
    return self.run(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 119, in run
    test(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 111, in __call__
    return self.run(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 119, in run
    test(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 111, in __call__
    return self.run(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/runner.py", line 119, in run
    test(result)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/unittest.py", line 343, in __call__
    return self.run(*args, **kwargs)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/unittest.py", line 477, in run
    self._wait(d)
  File "/home/exarkun/Projects/Twisted/trunk/twisted/trial/unittest.py", line 593, in _wait
    raise KeyboardInterrupt()
KeyboardInterrupt
exarkun@kunai:~$

Note that this is without ever hitting C.

Change History (5)

comment:1 Changed 11 years ago by jml

  • Status changed from new to assigned

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

comment:2 Changed 10 years ago by jml

  • Status changed from assigned to new

comment:3 Changed 10 years ago by exarkun

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 6 years ago by <automation>

  • Owner jml deleted

comment:5 Changed 3 years ago by Julian

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

Note: See TracTickets for help on using tickets.