[CalendarServer-changes] [11426] CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/ python

source_changes at macosforge.org source_changes at macosforge.org
Wed Jun 26 01:18:27 PDT 2013


Revision: 11426
          http://trac.calendarserver.org//changeset/11426
Author:   glyph at apple.com
Date:     2013-06-26 01:18:27 -0700 (Wed, 26 Jun 2013)
Log Message:
-----------
hm. why doesn't this work?

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py
    CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py

Modified: CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py
===================================================================
--- CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py	2013-06-26 08:17:57 UTC (rev 11425)
+++ CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/launchd.py	2013-06-26 08:18:27 UTC (rev 11426)
@@ -222,9 +222,9 @@
     @return: a C{dict}-like object.
     """
     return _launchify(
-        lib.launch_msg(
-            _managed(lib.launch_data_new_string(lib.LAUNCH_KEY_CHECKIN))
-        )
+        (lib.launch_msg(
+            (lib.launch_data_new_string(lib.LAUNCH_KEY_CHECKIN))
+        ))
     )
 
 

Modified: CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py
===================================================================
--- CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py	2013-06-26 08:17:57 UTC (rev 11425)
+++ CalendarServer/branches/users/glyph/launchd-wrapper-bis/twext/python/test/test_launchd.py	2013-06-26 08:18:27 UTC (rev 11426)
@@ -18,7 +18,7 @@
 Tests for L{twext.python.launchd}.
 """
 
-import sys, os, plistlib, socket
+import sys, os, plistlib, socket, json
 
 if __name__ == '__main__':
     testID = sys.argv[1]
@@ -27,13 +27,15 @@
     try:
         namedAny(".".join([a, b.replace("test_", "job_")]))()
     finally:
+        sys.stdout.flush()
+        sys.stderr.flush()
         skt = socket.socket()
         skt.connect(("127.0.0.1", int(os.environ["TESTING_PORT"])))
     sys.exit(0)
 
 
 from twext.python.launchd import (lib, ffi, LaunchDictionary, LaunchArray,
-                                  _managed, constants, plainPython)
+                                  _managed, constants, plainPython, checkin)
 
 from twisted.trial.unittest import TestCase
 from twisted.python.filepath import FilePath
@@ -260,6 +262,7 @@
             "KeepAlive": False,
             "StandardOutPath": self.stdout.path,
             "StandardErrorPath": fp.child("stderr.txt").path,
+            "Sockets": [{"SecureSocketWithKey": "GeneratedSocket"}],
             "RunAtLoad": True,
         }
         self.job = fp.child("job.plist")
@@ -290,13 +293,16 @@
         """
         Check in in the subprocess.
         """
-        checkin()
+        sys.stdout.write(json.dumps(plainPython(checkin())))
 
 
     def test_checkin(self):
         """
-        Checking in results 
+        L{checkin} performs launchd checkin and returns a launchd data
+        structure.
         """
+        d = json.loads(self.stdout.getContent())
+        self.assertIsInstance(d, dict)
 
 
     def tearDown(self):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130626/a9c15ddd/attachment.html>


More information about the calendarserver-changes mailing list