[Zope3-checkins] SVN: zdaemon/branches/py3/ Make tests pass on Python 3.3.

Marius Gedminas cvs-admin at zope.org
Thu Feb 14 15:33:42 UTC 2013


Log message for revision 129415:
  Make tests pass on Python 3.3.

Changed:
  U   zdaemon/branches/py3/setup.py
  U   zdaemon/branches/py3/src/zdaemon/tests/tests.py
  U   zdaemon/branches/py3/src/zdaemon/zdrun.py
  U   zdaemon/branches/py3/tox.ini

-=-
Modified: zdaemon/branches/py3/setup.py
===================================================================
--- zdaemon/branches/py3/setup.py	2013-02-14 15:33:40 UTC (rev 129414)
+++ zdaemon/branches/py3/setup.py	2013-02-14 15:33:42 UTC (rev 129415)
@@ -85,8 +85,8 @@
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
-       #'Programming Language :: Python :: 3',
-       #'Programming Language :: Python :: 3.3',
+       'Programming Language :: Python :: 3',
+       'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: Implementation :: CPython',
        'Operating System :: POSIX',
        'Topic :: Utilities',

Modified: zdaemon/branches/py3/src/zdaemon/tests/tests.py
===================================================================
--- zdaemon/branches/py3/src/zdaemon/tests/tests.py	2013-02-14 15:33:40 UTC (rev 129414)
+++ zdaemon/branches/py3/src/zdaemon/tests/tests.py	2013-02-14 15:33:42 UTC (rev 129415)
@@ -378,7 +378,7 @@
     with timeout(60):
         data = p.communicate(input)[0]
     if not quiet:
-        print(data, end='')
+        print(data.decode(), end='')
     r = p.wait()
     if r:
         print('Failed:', r)

Modified: zdaemon/branches/py3/src/zdaemon/zdrun.py
===================================================================
--- zdaemon/branches/py3/src/zdaemon/zdrun.py	2013-02-14 15:33:40 UTC (rev 129414)
+++ zdaemon/branches/py3/src/zdaemon/zdrun.py	2013-02-14 15:33:42 UTC (rev 129415)
@@ -191,6 +191,7 @@
                 except os.error as err:
                     sys.stderr.write("can't exec %r: %s\n" %
                                      (self.filename, err))
+                    sys.stderr.flush() # just in case
             finally:
                 os._exit(127)
             # Does not return
@@ -261,6 +262,7 @@
                     # Stale socket -- delete, sleep, and try again.
                     msg = "Unlinking stale socket %s; sleep 1" % sockname
                     sys.stderr.write(msg + "\n")
+                    sys.stderr.flush() # just in case
                     self.logger.warn(msg)
                     self.unlink_quietly(sockname)
                     sock.close()
@@ -292,6 +294,7 @@
             msg = ("Another zrdun is already up using socket %r:\n%s" %
                    (self.options.sockname, data))
             sys.stderr.write(msg + "\n")
+            sys.stderr.flush() # just in case
             self.logger.critical(msg)
             sys.exit(1)
 
@@ -601,11 +604,11 @@
     def __init__(self, filename):
         self.read_from, w = os.pipe()
         os.dup2(w, 1)
-        sys.stdout = sys.__stdout__ = os.fdopen(1, "a", 0)
+        sys.stdout = sys.__stdout__ = os.fdopen(1, "w", 1)
         os.dup2(w, 2)
-        sys.stderr = sys.__stderr__ = os.fdopen(2, "a", 0)
+        sys.stderr = sys.__stderr__ = os.fdopen(2, "w", 1)
         self.filename = filename
-        self.file = open(filename, 'a', 0)
+        self.file = open(filename, 'ab', 0)
         self.write = self.file.write
         self.lock = threading.Lock()
         thread = threading.Thread(target=self.copy)
@@ -626,7 +629,7 @@
     def reopen(self):
         self.lock.acquire()
         self.file.close()
-        self.file = open(self.filename, 'a', 0)
+        self.file = open(self.filename, 'ab', 0)
         self.write = self.file.write
         self.lock.release()
 

Modified: zdaemon/branches/py3/tox.ini
===================================================================
--- zdaemon/branches/py3/tox.ini	2013-02-14 15:33:40 UTC (rev 129414)
+++ zdaemon/branches/py3/tox.ini	2013-02-14 15:33:42 UTC (rev 129415)
@@ -1,27 +1,18 @@
 [tox]
-#envlist = py26,py27,py33
-envlist = py26,py27
+envlist = py26,py27,py33
 
 [testenv]
 commands =
     python setup.py test -q
 # without explicit deps, setup.py test will download a bunch of eggs into $PWD
 deps =
+    zc.customdoctests
     zope.testing
     zope.testrunner
     manuel
     mock
 
-[testenv:py26]
-deps =
-    {[testenv]deps}
-    zc.customdoctests
 
-[testenv:py27]
-deps =
-    {[testenv]deps}
-    zc.customdoctests
-
 [testenv:coverage]
 basepython =
     python2.7
@@ -33,6 +24,7 @@
     pip install -e .
     nosetests --with-xunit --with-xcoverage
 deps =
+    {[testenv]deps}
     nose
     coverage
     nosexcover



More information about the Zope3-Checkins mailing list