Rev 4614: (mbp) show platform in selftest, version and backtrace in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sat Aug 15 10:15:05 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4614 [merge]
revision-id: pqm at pqm.ubuntu.com-20090815091503-qwbm6glvv31rnujw
parent: pqm at pqm.ubuntu.com-20090814191423-zs4ej0tde7yhamha
parent: mbp at sourcefrog.net-20090815080750-kw8fh8trba5euzoh
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sat 2009-08-15 10:15:03 +0100
message:
  (mbp) show platform in selftest, version and backtrace
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
  bzrlib/version.py              version.py-20060816024207-ves6ult9a11taj9t-1
=== modified file 'NEWS'
--- a/NEWS	2009-08-14 17:36:03 +0000
+++ b/NEWS	2009-08-15 09:15:03 +0000
@@ -9,6 +9,16 @@
 In Development
 ##############
 
+Improvements
+************
+
+* A better description of the platform is shown in crash tracebacks, ``bzr
+  --version`` and ``bzr selftest``.
+  (Martin Pool, #409137)
+
+bzr 1.18
+########
+
 Compatibility Breaks
 ********************
 

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2009-08-14 13:55:30 +0000
+++ b/bzrlib/tests/__init__.py	2009-08-15 09:15:03 +0000
@@ -226,13 +226,17 @@
         self._recordTestStartTime()
 
     def startTests(self):
+        import platform
         self.stream.write(
             'testing: %s\n' % (osutils.realpath(sys.argv[0]),))
         self.stream.write(
-            '   %s (%s python%s)\n' % (
-                    bzrlib.__path__[0],
+            '   %s\n' % (
+                    bzrlib.__path__[0],))
+        self.stream.write(
+            '   bzr-%s python-%s %s\n' % (
                     bzrlib.version_string,
                     bzrlib._format_version_tuple(sys.version_info),
+                    platform.platform(aliased=1),
                     ))
         self.stream.write('\n')
 

=== modified file 'bzrlib/tests/test_selftest.py'
--- a/bzrlib/tests/test_selftest.py	2009-08-14 13:55:30 +0000
+++ b/bzrlib/tests/test_selftest.py	2009-08-15 09:15:03 +0000
@@ -998,19 +998,20 @@
         runner = tests.TextTestRunner(stream=stream)
         result = self.run_test_runner(runner, test)
         lines = stream.getvalue().splitlines()
-        self.assertEqual([
-            '',
-            '======================================================================',
-            'FAIL: unittest.FunctionTestCase (failing_test)',
-            '----------------------------------------------------------------------',
-            'Traceback (most recent call last):',
-            '    raise AssertionError(\'foo\')',
-            'AssertionError: foo',
-            '',
-            '----------------------------------------------------------------------',
-            '',
-            'FAILED (failures=1, known_failure_count=1)'],
-            lines[3:8] + lines[9:13] + lines[14:])
+        self.assertContainsRe(stream.getvalue(),
+            '(?sm)^testing.*$'
+            '.*'
+            '^======================================================================\n'
+            '^FAIL: unittest.FunctionTestCase \\(failing_test\\)\n'
+            '^----------------------------------------------------------------------\n'
+            'Traceback \\(most recent call last\\):\n'
+            '  .*' # File .*, line .*, in failing_test' - but maybe not from .pyc
+            '    raise AssertionError\\(\'foo\'\\)\n'
+            '.*'
+            '^----------------------------------------------------------------------\n'
+            '.*'
+            'FAILED \\(failures=1, known_failure_count=1\\)'
+            )
 
     def test_known_failure_ok_run(self):
         # run a test that generates a known failure which should be printed in the final output.

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2009-03-24 01:53:42 +0000
+++ b/bzrlib/trace.py	2009-08-14 12:08:08 +0000
@@ -478,12 +478,13 @@
 
 def report_bug(exc_info, err_file):
     """Report an exception that probably indicates a bug in bzr"""
+    import platform
     print_exception(exc_info, err_file)
     err_file.write('\n')
-    err_file.write('bzr %s on python %s (%s)\n' % \
+    err_file.write('bzr %s on python %s %s\n' % \
                        (bzrlib.__version__,
                         bzrlib._format_version_tuple(sys.version_info),
-                        sys.platform))
+                        platform.platform(aliased=1)))
     err_file.write('arguments: %r\n' % sys.argv)
     err_file.write(
         'encoding: %r, fsenc: %r, lang: %r\n' % (

=== modified file 'bzrlib/version.py'
--- a/bzrlib/version.py	2009-03-23 14:59:43 +0000
+++ b/bzrlib/version.py	2009-08-14 12:08:08 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2004, 2005, 2006, 2007 Canonical Ltd
+# Copyright (C) 2004, 2005, 2006, 2007, 2009 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -31,6 +31,8 @@
 
 
 def show_version(show_config=True, show_copyright=True, to_file=None):
+    import platform
+
     if to_file is None:
         to_file = sys.stdout
     to_file.write("Bazaar (bzr) %s\n" % bzrlib.__version__)
@@ -62,6 +64,7 @@
 
     to_file.write("  Python standard library:" + ' ')
     to_file.write(os.path.dirname(os.__file__) + '\n')
+    to_file.write("  Platform: %s\n" % platform.platform(aliased=1))
     to_file.write("  bzrlib: ")
     if len(bzrlib.__path__) > 1:
         # print repr, which is a good enough way of making it clear it's




More information about the bazaar-commits mailing list