[ZCM] [ZC] 1904/ 1 Request "zopectl test now (slightly) broken under OS X"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Sat Sep 17 12:22:09 EDT 2005


Issue #1904 Update (Request) "zopectl test now (slightly) broken under OS X"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/1904

==============================================================
= Request - Entry #1 by jens on Sep 17, 2005 12:22 pm

Tres checked in a change recently to ensure that a zopectl shell will not exit if you run tests from within it:

svn diff -r 37700:37701 zopectl.py 
Index: zopectl.py
===================================================================
--- zopectl.py  (revision 37700)
+++ zopectl.py  (revision 37701)
@@ -259,7 +259,11 @@
         args.insert(0, self.options.python)
 
         print 'Running tests via: %s' % ' '.join(args)
-        os.execv(self.options.python, args)
+        pid = os.fork()
+        if pid == 0:  # child
+            os.execv(self.options.python, args)
+        else:
+            os.waitpid(pid, 0) 

Unfortunately, this patch will lead to an exit and nasty traceback on OS X, regardless of how zopectl test is run (from a zopectl shell or using "zopectl test --dir FOO, for example):

----------------------------------------------
tiny:/usr/local/zope/28Instance jens$ bin/zopectl test --dir Products/CMFLDAP/
Running tests via: /usr/local/bin/python /usr/local/zope/opt/Zope-2.8.1/bin/test.py -v --config-file /usr/local/zope/28Instance/etc/zope.conf --libdir Products --dir Products/CMFLDAP/
Running unit tests at level 1
Running unit tests from /usr/local/zope/28Instance/Products/CMFLDAP
Parsing /usr/local/zope/28Instance/etc/zope.conf
...................
----------------------------------------------------------------------
Ran 19 tests in 3.510s

OK
Traceback (most recent call last):
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 314, in ?
    main()
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 283, in main
    c.onecmd(" ".join(options.args))
  File "/usr/local/lib/python2.3/cmd.py", line 210, in onecmd
    return func(arg)
  File "/usr/local/zope/opt/Zope-2.8.1/lib/python/Zope2/Startup/zopectl.py", line 268, in do_test
    os.waitpid(pid, 0)
OSError: [Errno 4] Interrupted system call
---------------------------------------------

I have played around with a couple different combinations to replace the patch, but could not come up with a combination that prevents the traceback *and* fixes the "testing exits zopectl shell" issue this patch was designed to fix :(

==============================================================



More information about the Zope-Collector-Monitor mailing list