Rev 3944: Properly clean up the progress stack when a nested progress bar is finished. in http://bzr.arbash-meinel.com/branches/bzr/1.12/progress_updates

John Arbash Meinel john at arbash-meinel.com
Fri Jan 16 19:08:17 GMT 2009


At http://bzr.arbash-meinel.com/branches/bzr/1.12/progress_updates

------------------------------------------------------------
revno: 3944
revision-id: john at arbash-meinel.com-20090116190749-c9oqg2m8yrek0jnz
parent: pqm at pqm.ubuntu.com-20090115233242-4bxyn4zcj2a0ksfk
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: progress_updates
timestamp: Fri 2009-01-16 13:07:49 -0600
message:
  Properly clean up the progress stack when a nested progress bar is finished.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py	2009-01-15 06:44:09 +0000
+++ b/bzrlib/tests/test_ui.py	2009-01-16 19:07:49 +0000
@@ -144,11 +144,15 @@
         ui = TextUIFactory(None, None, None)
         pb1 = ui.nested_progress_bar()
         pb2 = ui.nested_progress_bar()
+        self.assertEqual(2, len(ui._task_stack))
         # We no longer warn about finishing unnested progress bars.
         warnings, _ = self.callCatchWarnings(pb1.finished)
-        self.assertEqual(len(warnings), 0)
+        self.assertEqual(len(warnings), 0,
+            "There should be no warnings: %s" % warnings)
         pb2.finished()
+        self.assertEqual(1, len(ui._task_stack))
         pb1.finished()
+        self.assertEqual(0, len(ui._task_stack))
 
     def test_progress_stack(self):
         # test the progress bar stack which the default text factory 

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2009-01-13 05:07:27 +0000
+++ b/bzrlib/ui/__init__.py	2009-01-16 19:07:49 +0000
@@ -83,7 +83,7 @@
 
     def progress_finished(self, task):
         if task != self._task_stack[-1]:
-            warnings.warn("%r is not currently active" % (task,))
+            pass # We no longer warn about unfinished nested progress bars
         else:
             del self._task_stack[-1]
 
@@ -179,9 +179,6 @@
     def show_progress(self, task):
         pass
 
-    def progress_finished(self, task):
-        pass
-
 
 class SilentUIFactory(CLIUIFactory):
     """A UI Factory which never prints anything.
@@ -195,7 +192,6 @@
     def get_password(self, prompt='', **kwargs):
         return None
 
-
     def note(self, msg):
         pass
 



More information about the bazaar-commits mailing list