[Checkins] SVN: zc.selenium/branches/wosc-zope2/src/zc/selenium/selenium.py stop zope2 instance after tests have been run

Wolfgang Schnerring wosc at wosc.de
Wed Feb 18 04:41:12 EST 2009


Log message for revision 96684:
  stop zope2 instance after tests have been run
  

Changed:
  U   zc.selenium/branches/wosc-zope2/src/zc/selenium/selenium.py

-=-
Modified: zc.selenium/branches/wosc-zope2/src/zc/selenium/selenium.py
===================================================================
--- zc.selenium/branches/wosc-zope2/src/zc/selenium/selenium.py	2009-02-18 09:19:24 UTC (rev 96683)
+++ zc.selenium/branches/wosc-zope2/src/zc/selenium/selenium.py	2009-02-18 09:41:12 UTC (rev 96684)
@@ -51,13 +51,25 @@
     import Zope2.Startup.zopectl
     # XXX is it really supposed to be this hard to do commandline ZConfig
     # overrides when using zopectl?
-    original_fg = Zope2.Startup.zopectl.ZopeCmd.do_foreground
-    def do_foreground_port(self, arg):
+    original_start = Zope2.Startup.zopectl.ZopeCmd.do_start
+    def do_start_port(self, arg):
         self.options.program[1:1] = ["-X", "http-server/address=" + port]
-        original_fg(self, arg)
-    Zope2.Startup.zopectl.ZopeCmd.do_foreground = do_foreground_port
-    Zope2.Startup.zopectl.main(["-C", config, 'fg'] + sys.argv[1:])
+        original_start(self, arg)
+    Zope2.Startup.zopectl.ZopeCmd.do_start = do_start_port
 
+    Zope2.Startup.zopectl.main(["-C", config, 'start'] + sys.argv[1:])
+    while True:
+        time.sleep(10000)
+
+def stop_zope2(config, port):
+    import Zope2.Startup.zopectl
+    original_stop = Zope2.Startup.zopectl.ZopeCmd.do_stop
+    def do_stop_port(self, arg):
+        self.options.program[1:1] = ["-X", "http-server/address=" + port]
+        original_stop(self, arg)
+    Zope2.Startup.zopectl.ZopeCmd.do_stop = do_stop_port
+    Zope2.Startup.zopectl.main(["-C", config, 'stop'])
+
 def make_wsgi_run_zope(app_path):
     import wsgiref.simple_server
     module, name = app_path.rsplit('.', 1)
@@ -260,6 +272,8 @@
         while True:
             time.sleep(10000)
     else:
+        if options.runner == 'zope2':
+            stop_zope2(options.config, options.port)
         # exit with 0 if all tests passed, 1 if any failed
         sys.exit(not test_result)
 



More information about the Checkins mailing list