[Pkg-privacy-commits] [mat] 01/02: eliminate unneeded uses of sleep()

Sascha Steinbiss sascha at steinbiss.name
Thu Mar 17 00:09:10 UTC 2016


This is an automated email from the git hooks/post-receive script.

sascha-guest pushed a commit to branch gui_tests
in repository mat.

commit 59ddf4a6cdb6190819f11795daf8dc3584bdf0c6
Author: Sascha Steinbiss <sascha at steinbiss.name>
Date:   Wed Mar 16 23:24:00 2016 +0000

    eliminate unneeded uses of sleep()
---
 debian/tests/check-mat | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/debian/tests/check-mat b/debian/tests/check-mat
index 8a356f1..aaddcbb 100755
--- a/debian/tests/check-mat
+++ b/debian/tests/check-mat
@@ -107,7 +107,7 @@ class TestMatGUIFunctional(unittest.TestCase):
             p.join()
         os.system("killall -9 mat-gui || true")
 
-    def add_dirty_directory_contents(self):
+    def add_dirty_directory_contents(self, wait=True):
         """
         Add the contents of a directory with dirty files to MAT.
         """
@@ -116,8 +116,13 @@ class TestMatGUIFunctional(unittest.TestCase):
         window = self.rootapp.child(roleName='file chooser', recursive=False)
         window.child("mat").click()
         window.child(self.tmpdir).click()
+        if wait:
+            sw = StatusbarWatcher()
+            sw.start()
         window.child("OK").click()
-        time.sleep(5)
+        if wait:
+            sw.wait_until_last_item_is("Ready")
+            sw.stop()
 
     def test_gui_cleans_stuff_reduced_pdf_quality(self):
         """
@@ -131,8 +136,11 @@ class TestMatGUIFunctional(unittest.TestCase):
         pref.child("OK").click()
 
         self.add_dirty_directory_contents()
+        sw = StatusbarWatcher()
+        sw.start()
         self.clean.click()
-        time.sleep(30)
+        sw.wait_until_last_item_is("Ready")
+        sw.stop()
 
         self.quit_via_menu()
 
@@ -145,9 +153,11 @@ class TestMatGUIFunctional(unittest.TestCase):
         Check whether files cleaned via the GUI are actually clean.
         """
         self.add_dirty_directory_contents()
+        sw = StatusbarWatcher()
+        sw.start()
         self.clean.click()
-        time.sleep(30)
-
+        sw.wait_until_last_item_is("Ready")
+        sw.stop()
         self.quit_via_menu()
 
         for f in self.file_list:
@@ -156,7 +166,7 @@ class TestMatGUIFunctional(unittest.TestCase):
 
     def add_dirty_archive(self):
         """
-        Add the contents of an archive wih unsupported files to MAT.
+        Add the contents of an archive with unsupported files to MAT.
         """
         focus.frame(self.mat_window_title)
         self.add.click()
@@ -170,8 +180,11 @@ class TestMatGUIFunctional(unittest.TestCase):
         time.sleep(1)
         rawinput.pressKey('Down')
         time.sleep(1)
+        sw = StatusbarWatcher()
+        sw.start()
         rawinput.pressKey('Return')
-        time.sleep(10)
+        sw.wait_until_last_item_is("Ready")
+        sw.stop()
 
     def _test_gui_archive_with_unsupported_file(self, with_pref_set, select_in_dialog):
         """
@@ -234,10 +247,9 @@ class TestMatGUIFunctional(unittest.TestCase):
         """
         Check whether the status bar gets the "Checking/Cleaning X" updates.
         """
-
         sw = StatusbarWatcher()
         sw.start()
-        self.add_dirty_directory_contents()
+        self.add_dirty_directory_contents(False)
         sw.wait_until_last_item_is("Ready")
         sw.stop()
         for f in self.file_list:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/mat.git



More information about the Pkg-privacy-commits mailing list