[Zope-CVS] CVS: Products/ZCTextIndex/tests - mailtest.py:1.1.2.17

Fred L. Drake, Jr. fdrake@acm.org
Tue, 7 May 2002 18:36:16 -0400


Update of /cvs-repository/Products/ZCTextIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv2202/tests

Modified Files:
      Tag: TextIndexDS9-branch
	mailtest.py 
Log Message:
Added option to run this under HotShot for Python 2.2.

=== Products/ZCTextIndex/tests/mailtest.py 1.1.2.16 => 1.1.2.17 ===
     query_str = None
     mbox_path = None
+    profile = None
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'vn:p:i:q:b:xt:')
+        opts, args = getopt.getopt(sys.argv[1:], 'vn:p:i:q:b:xt:',
+                                   ['profile='])
     except getopt.error, msg:
         usage(msg)
     if len(args) != 1:
@@ -197,5 +199,13 @@
             EXCLUDE_TEXT = 1
         elif o == '-t':
             TXN_SIZE = int(v)
+        elif o == '--profile':
+            profile = v
     fs_path, = args
-    main(fs_path, mbox_path, query_str)
+    if profile:
+        import hotshot
+        profiler = hotshot.Profile(profile, lineevents=1, linetimings=1)
+        profiler.runcall(main, fs_path, mbox_path, query_str)
+        profiler.close()
+    else:
+        main(fs_path, mbox_path, query_str)