[Spambayes-checkins] spambayes/Outlook2000 tester.py,1.9,1.10

Mark Hammond mhammond at users.sourceforge.net
Sun Jul 27 17:50:01 EDT 2003


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv18006

Modified Files:
	tester.py 
Log Message:
Test timer based filtering.


Index: tester.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/tester.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** tester.py	20 Jul 2003 13:37:00 -0000	1.9
--- tester.py	27 Jul 2003 23:49:59 -0000	1.10
***************
*** 29,33 ****
  def WaitForFilters():
      import pythoncom
!     for i in range(100):
          pythoncom.PumpWaitingMessages()
          sleep(0.01)
--- 29,34 ----
  def WaitForFilters():
      import pythoncom
!     # Must wait longer than normal, so when run with a timer we still work.
!     for i in range(500):
          pythoncom.PumpWaitingMessages()
          sleep(0.01)
***************
*** 320,340 ****
      driver.CleanAllTestMessages()
  
! def test(manager = None):
      # Run the tests - called from our plugin.
      try:
          # setup config to save info with the message, and test
!         print "Running tests with save_spam_info=True"
          manager.config.filter.save_spam_info = True
          run_tests(manager)
          # do it again with the same config, just to prove we can.
!         print "Running them again with save_spam_info=True"
          run_tests(manager)
          # and with save_spam_info False.
!         print "Running tests with save_spam_info=False"
          manager.config.filter.save_spam_info = False
          run_tests(manager)
      finally:
          # Always restore configuration to how we started.
          manager.LoadConfig()
  
  if __name__=='__main__':
--- 321,354 ----
      driver.CleanAllTestMessages()
  
! def test(manager):
      # Run the tests - called from our plugin.
+     import msgstore
      try:
+         msgstore.test_suite_running = True
          # setup config to save info with the message, and test
!         print "*" * 10, "Running tests with save_spam_info=True, timer off"
!         manager.config.experimental.timer_start_delay = 0
!         manager.config.experimental.timer_interval = 0
          manager.config.filter.save_spam_info = True
+         manager.addin.FiltersChanged() # to ensure correct filtler in place
          run_tests(manager)
          # do it again with the same config, just to prove we can.
!         print "*" * 10, "Running them again with save_spam_info=True"
!         run_tests(manager)
!         # enable the timer.
!         manager.config.experimental.timer_start_delay = 1000
!         manager.config.experimental.timer_interval = 500
!         manager.addin.FiltersChanged() # to switch to timer based filters.
!         print "*" * 10, "Running them again with save_spam_info=True, and timer enabled"
          run_tests(manager)
          # and with save_spam_info False.
!         print "*" * 10, "Running tests with save_spam_info=False"
          manager.config.filter.save_spam_info = False
          run_tests(manager)
      finally:
          # Always restore configuration to how we started.
+         msgstore.test_suite_running = False
          manager.LoadConfig()
+         manager.addin.FiltersChanged() # restore original filters.
  
  if __name__=='__main__':





More information about the Spambayes-checkins mailing list