[gvfs] gvfs-test: Fix logic error in waiting for prompt



commit e5c4b5f2c951ff9271ac0e801eb1aaeff547c223
Author: Martin Pitt <martinpitt gnome org>
Date:   Tue Nov 20 15:47:25 2012 +0100

    gvfs-test: Fix logic error in waiting for prompt
    
    Do not try to check the prompt string if it is None (which can happen for
    non-blocking streams).
    
    Also add a (commented out) debug print to help with figuring out why some of
    the calls take a very long time.

 test/gvfs-test |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/test/gvfs-test b/test/gvfs-test
index e68c93e..1536c8d 100755
--- a/test/gvfs-test
+++ b/test/gvfs-test
@@ -140,13 +140,13 @@ class GvfsTestCase(unittest.TestCase):
         empty_timeout = 50
         while True:
             r = popen.stdout.read(1000)
-            if not r:
-                empty_timeout -= 1
-                self.assertGreater(empty_timeout, 0,
-                                   'timed out waiting for auth prompt')
-
-            if b'User' in r or b'Domain' in r:
+            #print('  wait_for_gvfs_mount_user_prompt: got "%s"' % str(r))
+            if r and (b'User' in r or b'Domain' in r):
                 break
+
+            self.assertGreater(empty_timeout, 0,
+                               'timed out waiting for auth prompt')
+            empty_timeout -= 1
             time.sleep(0.1)
 
 class Programs(GvfsTestCase):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]