Rev 5936: Merge spiv proposal resolving conflicts in http://bazaar.launchpad.net/~vila/bzr/integration/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat May 28 09:08:19 UTC 2011
At http://bazaar.launchpad.net/~vila/bzr/integration/
------------------------------------------------------------
revno: 5936 [merge]
revision-id: v.ladeuil+lp at free.fr-20110528090819-onm417b45vfhb7ni
parent: pqm at pqm.ubuntu.com-20110528072339-sz8zc51i8sv71lgx
parent: andrew.bennetts at canonical.com-20110527065628-dr95zffuudgbeoah
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: trunk
timestamp: Sat 2011-05-28 11:08:19 +0200
message:
Merge spiv proposal resolving conflicts
modified:
bzrlib/tests/__init__.py selftest.py-20050531073622-8d0e3c8845c97a64
doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
-------------- next part --------------
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py 2011-05-27 21:41:02 +0000
+++ b/bzrlib/tests/__init__.py 2011-05-28 09:08:19 +0000
@@ -988,6 +988,7 @@
# settled on or a the FIXME associated with _get_expand_default_value
# is addressed -- vila 20110219
self.overrideAttr(config, '_expand_default_value', None)
+ self._log_files = set()
def debug(self):
# debug a frame up.
@@ -1637,7 +1638,7 @@
pseudo_log_file = StringIO()
def _get_log_contents_for_weird_testtools_api():
return [pseudo_log_file.getvalue().decode(
- "utf-8", "replace").encode("utf-8")]
+ "utf-8", "replace").encode("utf-8")]
self.addDetail("log", content.Content(content.ContentType("text",
"plain", {"charset": "utf8"}),
_get_log_contents_for_weird_testtools_api))
@@ -2065,6 +2066,9 @@
# so we will avoid using it on all platforms, just to
# make sure the code path is used, and we don't break on win32
cleanup_environment()
+ # Include the subprocess's log file in the test details, in case
+ # the test fails due to an error in the subprocess.
+ self._add_subprocess_log(trace._get_bzr_log_filename())
command = [sys.executable]
# frozen executables don't need the path to bzr
if getattr(sys, "frozen", None) is None:
@@ -2082,6 +2086,26 @@
return process
+ def _add_subprocess_log(self, log_file_path):
+ if len(self._log_files) == 0:
+ # Register an addCleanup func. We do this on the first call to
+ # _add_subprocess_log rather than in TestCase.setUp so that this
+ # addCleanup is registered after any cleanups for tempdirs that
+ # subclasses might create, which will probably remove the log file
+ # we want to read.
+ self.addCleanup(self._subprocess_log_cleanup)
+ # self._log_files is a set, so if a log file is reused we won't grab it
+ # twice.
+ self._log_files.add(log_file_path)
+
+ def _subprocess_log_cleanup(self):
+ for count, log_file_path in enumerate(self._log_files):
+ # We use buffer_now=True to avoid holding the file open beyond
+ # the life of this function, which might interfere with e.g.
+ # cleaning tempdirs on Windows.
+ self.addDetail("start_bzr_subprocess-log-%d" % (count,),
+ content.content_from_file(log_file_path, buffer_now=True))
+
def _popen(self, *args, **kwargs):
"""Place a call to Popen.
=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt 2011-05-28 06:44:01 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt 2011-05-28 09:08:19 +0000
@@ -84,13 +84,17 @@
the default OS buffer size for pipes is small or the ``python -v``
output is large. (Andrew Bennetts, #784802)
+* Multiple ``selftest --exclude`` options are now combined instead of
+ overriding each other. (Vincent Ladeuil, #746991)
+
+* Show log file contents from subprocesses started by
+ `start_bzr_subprocess` in test failure details. This may help diagnose
+ strange hangs and failures involving subprocesses. (Andrew Bennetts)
+
* Skip ``utextwrap`` tests when ``sphinx`` breaks text_wrap by an hostile
monkeypatch to textwrap.TextWrapper.wordsep_re.
(Vincent Ladeuil, #785098)
-* Multiple ``selftest --exclude`` options are now combined instead of
- overriding each other. (Vincent Ladeuil, #746991)
-
bzr 2.4b3
#########
More information about the bazaar-commits
mailing list