← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/txfixtures/use-details into lp:txfixtures

 

Gavin Panella has proposed merging lp:~allenap/txfixtures/use-details into lp:txfixtures with lp:~allenap/txfixtures/get-pid-in-tachandler as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/txfixtures/use-details/+merge/84327
-- 
https://code.launchpad.net/~allenap/txfixtures/use-details/+merge/84327
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/txfixtures/use-details into lp:txfixtures.
=== modified file 'txfixtures/tachandler.py'
--- txfixtures/tachandler.py	2011-12-02 20:46:25 +0000
+++ txfixtures/tachandler.py	2011-12-02 20:46:25 +0000
@@ -21,6 +21,7 @@
 
 from fixtures import Fixture
 
+from testtools.content import content_from_file
 from txfixtures.osutils import (
     get_pid_from_file,
     kill_by_pidfile,
@@ -50,7 +51,7 @@
         :param twistd_script: If set, run this twistd script rather than the
             system default.  Must be provided if python_path is given.
         """
-        Fixture.setUp(self)
+        super(TacTestFixture, self).setUp()
         if get_pid_from_file(self.pidfile):
             # An attempt to run while there was an existing live helper
             # was made. Note that this races with helpers which use unique
@@ -113,6 +114,7 @@
         if rv != 0:
             raise TacException('Error %d running %s' % (rv, args))
 
+        self.addDetail(self.logfile, content_from_file(self.logfile))
         self._waitForDaemonStartup()
 
     def _hasDaemonStarted(self):
@@ -156,8 +158,7 @@
             now = time.time()
 
         if now >= deadline:
-            raise TacException('Unable to start %s. Content of %s:\n%s' % (
-                self.tacfile, self.logfile, open(self.logfile).read()))
+            raise TacException('Unable to start %s.' % self.tacfile)
 
     def tearDown(self):
         # For compatibility - migrate to cleanUp.