[Pkg-bazaar-commits] ./bzr-gtk/unstable r606: Fix gtk dialogs popping up and asking for input during selftest.

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Apr 10 07:44:27 UTC 2009


------------------------------------------------------------
revno: 606
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: gtk
timestamp: Mon 2008-09-29 18:10:51 +0200
message:
  Fix gtk dialogs popping up and asking for input during selftest.
  
  * tests/test_commit.py:
  (TestCommitDialog_Commit._set_question_yes,
  TestCommitDialog_Commit._set_question_no): Accept keyword
  arguments (but ignore them).
  (TestCommitDialog_Commit.test_commit_empty_message): Rename the
  test to avoid confusion with test_commit_no_messages.
  
  * commit.py:
  (CommitDialog.__init__): Restore the ability to override the
  dialog used for automated tests.
  (CommitDialog._do_commit, CommitDialog._do_commit,
  CommitDialog._do_commit): Use the dialog class defined at
  construction time.
modified:
  commit.py
  tests/test_commit.py
-------------- next part --------------
=== modified file 'commit.py'
--- a/commit.py	2008-08-25 17:20:50 +0000
+++ b/commit.py	2008-09-29 16:10:51 +0000
@@ -104,7 +104,9 @@
         gtk.Dialog.__init__(self, title="Commit to %s" % wt.basedir,
                                   parent=parent,
                                   flags=0,
-                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+                                  buttons=(gtk.STOCK_CANCEL,
+                                           gtk.RESPONSE_CANCEL))
+        self._question_dialog = question_dialog
 
         self._wt = wt
         # TODO: Do something with this value, it is used by Olive
@@ -650,7 +652,7 @@
         message = self._get_global_commit_message()
 
         if message == '':
-            response = question_dialog(
+            response = self._question_dialog(
                 _i18n('Commit with an empty message?'),
                 _i18n('You can describe your commit intent in the message.'),
                 parent=self)
@@ -671,7 +673,7 @@
         #       entirely, since there isn't a way for them to add the unknown
         #       files at this point.
         for path in self._wt.unknowns():
-            response = question_dialog(
+            response = self._question_dialog(
                 _i18n("Commit with unknowns?"),
                 _i18n("Unknown files exist in the working tree. Commit anyway?"),
                 parent=self)
@@ -692,7 +694,7 @@
                        specific_files=specific_files,
                        revprops=revprops)
         except errors.PointlessCommit:
-            response = question_dialog(
+            response = self._question_dialog(
                 _i18n('Commit with no changes?'),
                 _i18n('There are no changes in the working tree.'
                       ' Do you want to commit anyway?'),

=== modified file 'tests/test_commit.py'
--- a/tests/test_commit.py	2008-06-10 15:25:47 +0000
+++ b/tests/test_commit.py	2008-09-29 16:10:51 +0000
@@ -651,7 +651,7 @@
     def _set_question_yes(self, dlg):
         """Set the dialog to answer YES to any questions."""
         self.questions = []
-        def _question_yes(*args):
+        def _question_yes(*args, **kwargs):
             self.questions.append(args)
             self.questions.append('YES')
             return gtk.RESPONSE_YES
@@ -660,7 +660,7 @@
     def _set_question_no(self, dlg):
         """Set the dialog to answer NO to any questions."""
         self.questions = []
-        def _question_no(*args):
+        def _question_no(*args, **kwargs):
             self.questions.append(args)
             self.questions.append('NO')
             return gtk.RESPONSE_NO
@@ -708,7 +708,7 @@
         self.assertEqual(last_rev, dlg.committed_revision_id)
         self.assertEqual(last_rev, tree.branch.last_revision())
 
-    def test_commit_no_message(self):
+    def test_commit_empty_message(self):
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/a', 'tree/b'])
         tree.add(['a'], ['a-id'])



More information about the Pkg-bazaar-commits mailing list