No test.log output under Twisted/trial runner

Bug #942785 reported by Eric P. Mangold
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Fix Released
Wishlist
Jonathan Lange

Bug Description

Expecting _trial_temp/test.log to contain logging output. Do get expected output when using normal twisted.trial.unittest.TestCase.

Not sure what the console message regarding "twisted-log" is all about...

% cat junk.py
from testtools import TestCase
from twisted.python import log
from testtools.deferredruntest import AsynchronousDeferredRunTest

class MyTestCase(TestCase):
    run_tests_with = AsynchronousDeferredRunTest

    def test_foo(self):
        log.msg("OH NOZ")
        self.failIf(True)
% trial junk.py
  MyTestCase
    test_foo ... [FAIL]

===============================================================================
[FAIL]: junk.MyTestCase.test_foo

Traceback (most recent call last):
Failure: testtools.testresult.real._StringException: Empty attachments:
  twisted-log

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/internet/defer.py", line 125, in maybeDeferred
    result = f(*args, **kw)
  File "/home/teratorn/.local/lib/python2.6/site-packages/testtools/testcase.py", line 566, in _run_test_method
    return self._get_test_method()()
  File "/home/teratorn/code/cattura-support-agent/junk.py", line 10, in test_foo
    self.failIf(True)
  File "/usr/lib/python2.6/unittest.py", line 321, in failIf
    if expr: raise self.failureException, msg
AssertionError

-------------------------------------------------------------------------------
Ran 1 tests in 0.017s

FAILED (failures=1)
% cat _trial_temp/test.log
2012-02-28 10:05:45-0600 [-] Log opened.
2012-02-28 10:05:45-0600 [-] using set_wakeup_fd

Tags: trial twisted
Revision history for this message
Robert Collins (lifeless) wrote :

I suspect (I haven't checked) that we divert the twisted log to capture it internally - the _trial_temp global is a particular bit of anti-parallel pattern from trials early days that hasn't managed to be purged. There is something definitely wrong here though.

Changed in testtools:
status: New → Triaged
importance: Undecided → Wishlist
Revision history for this message
Jonathan Lange (jml) wrote :

Related to #1515362, I think.

Primary use case is streaming logs that can be watched while running a test (esp. useful when debugging slow / maybe hung tests). Secondary use case is log analysis from a whole test run.

Revision history for this message
Jonathan Lange (jml) wrote :
Revision history for this message
Jonathan Lange (jml) wrote :
Changed in testtools:
status: Triaged → In Progress
assignee: nobody → Jonathan Lange (jml)
Jonathan Lange (jml)
Changed in testtools:
status: In Progress → Fix Committed
milestone: none → next
Jonathan Lange (jml)
Changed in testtools:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.