Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Portage Developer (http://www.linux-archive.org/gentoo-portage-developer/)
-   -   update test to use callback (http://www.linux-archive.org/gentoo-portage-developer/641188-update-test-use-callback.html)

"Brian C. Lane" 03-05-2012 06:47 PM

update test to use callback
 
From: "Brian C. Lane" <bcl@redhat.com>

---
testpyisomd5sum.py | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/testpyisomd5sum.py b/testpyisomd5sum.py
index c20f582..7158f78 100755
--- a/testpyisomd5sum.py
+++ b/testpyisomd5sum.py
@@ -18,5 +18,20 @@ print "Implanting again forcing -> ", pyisomd5sum.implantisomd5sum("testiso.iso"
# check it
print "Checking -> ",pyisomd5sum.checkisomd5sum("testiso.iso")

+def callback(offset, total):
+ print "%s - %s" % (offset, total)
+
+print "Run with callback"
+pyisomd5sum.checkisomd5sum("testiso.iso", callback)
+
+def callback_abort(offset, total):
+ print "%s - %s" % (offset, total)
+ if offset > 500000:
+ return True
+ return False
+
+print "Run with callback and abort after offset of 500000"
+pyisomd5sum.checkisomd5sum("testiso.iso", callback_abort)
+
# clean up
os.unlink("testiso.iso")
--
1.7.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 10:39 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.