Test failures on Python 3.5

Bug #1467644 reported by Barry Warsaw on 2015-06-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.testing
Undecided
Unassigned

Bug Description

Running the test suite on Python 3.5 (current upstream hg head) produces failures due to the printing of the exception. Since it works on Python 3.4, and I've scanned unsuccessfully for a NEWS item or other commit message for change in Python behavior, I don't know whether the bug is due to a change in Python 3.5 or something in zope.testing not yet caught up. Here's the failing output:

....F
======================================================================
FAIL: /home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt
Doctest: wait.txt
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/doctest.py", line 2189, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for wait.txt
  File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 0

----------------------------------------------------------------------
File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 23, in wait.txt
Failed example:
    wait((lambda : False), timeout=.01)
Expected:
    Traceback (most recent call last):
    ...
    TimeOutWaitingFor: <lambda>
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.5/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest wait.txt[2]>", line 1, in <module>
        wait((lambda : False), timeout=.01)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 65, in __call__
        getattr(func, '__name__')
    zope.testing.wait.Wait.TimeOutWaitingFor: <lambda>
----------------------------------------------------------------------
File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 52, in wait.txt
Failed example:
    @wait(timeout=.01)
    def no_way():
        pass
Expected:
    Traceback (most recent call last):
    ...
    TimeOutWaitingFor: no_way
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.5/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest wait.txt[4]>", line 1, in <module>
        @wait(timeout=.01)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 43, in <lambda>
        return lambda func: self(func, timeout, wait, message)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 65, in __call__
        getattr(func, '__name__')
    zope.testing.wait.Wait.TimeOutWaitingFor: no_way
----------------------------------------------------------------------
File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 59, in wait.txt
Failed example:
    @wait(timeout=.01)
    def no_way():
        "never true"
Expected:
    Traceback (most recent call last):
    ...
    TimeOutWaitingFor: never true
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.5/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest wait.txt[5]>", line 1, in <module>
        @wait(timeout=.01)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 43, in <lambda>
        return lambda func: self(func, timeout, wait, message)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 65, in __call__
        getattr(func, '__name__')
    zope.testing.wait.Wait.TimeOutWaitingFor: never true
----------------------------------------------------------------------
File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 70, in wait.txt
Failed example:
    @wait(timeout=.01, message='dang')
    def no_way():
        "never true"
Expected:
    Traceback (most recent call last):
    ...
    TimeOutWaitingFor: dang
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.5/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest wait.txt[8]>", line 1, in <module>
        @wait(timeout=.01, message='dang')
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 43, in <lambda>
        return lambda func: self(func, timeout, wait, message)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 65, in __call__
        getattr(func, '__name__')
    zope.testing.wait.Wait.TimeOutWaitingFor: dang
----------------------------------------------------------------------
File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.txt", line 162, in wait.txt
Failed example:
    @wait(timeout=0)
    def _(state=[]):
        if len(state) > 1:
           return True
        state.append(0)
Expected:
    Traceback (most recent call last):
    ...
    TimeOutWaitingFor: _
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python3.5/doctest.py", line 1320, in __run
        compileflags, 1), test.globs)
      File "<doctest wait.txt[19]>", line 2, in <module>
        def _(state=[]):
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 43, in <lambda>
        return lambda func: self(func, timeout, wait, message)
      File "/home/barry/projects/debian/ztesting/upstream/build/lib/zope/testing/wait.py", line 65, in __call__
        getattr(func, '__name__')
    zope.testing.wait.Wait.TimeOutWaitingFor: _

----------------------------------------------------------------------
Ran 5 tests in 0.133s

FAILED (failures=1)

Barry Warsaw (barry) wrote :
Marius Gedminas (mgedmin) wrote :

I built the latest hg of the 3.5 branch, 'make install'ed it into ~/python3.5, and I cannot reproduce your bug -- I get a different one:

mg@platonas: ~/src/zopefoundation/zope.testing [git:master=] $ tox -e py35 -r
GLOB sdist-make: /home/mg/src/zopefoundation/zope.testing/setup.py
py35 recreate: /home/mg/src/zopefoundation/zope.testing/.tox/py35
py35 installdeps: zope.exceptions, zope.interface
py35 inst: /home/mg/src/zopefoundation/zope.testing/.tox/dist/zope.testing-4.2.1.dev0.zip
py35 installed: wheel==0.24.0,zope.exceptions==4.0.7,zope.interface==4.1.2,zope.testing==4.2.1.dev0
py35 runtests: PYTHONHASHSEED='2911124267'
py35 runtests: commands[0] | python setup.py -q test -q
E
======================================================================
ERROR: tests (unittest.loader._FailedTest)
----------------------------------------------------------------------
Traceback (most recent call last):
ImportError: Failed to import test module: tests
Traceback (most recent call last):
  File "/home/mg/python3.5/lib/python3.5/unittest/loader.py", line 153, in loadTestsFromName
    module = __import__(module_name)
  File "/home/mg/src/zopefoundation/zope.testing/build/lib/zope/testing/tests.py", line 14, in <module>
    from . import doctest
ImportError: bad magic number in 'zope.testing.doctest': b'\x03\xf3\r\n'

----------------------------------------------------------------------
Ran 1 test in 0.000s

FAILED (errors=1)
ERROR: InvocationError: '/home/mg/src/zopefoundation/zope.testing/.tox/py35/bin/python setup.py -q test -q'
___________________________________ summary ___________________________________
ERROR: py35: commands failed

(Launchpad's bug tracker is bad, let's use GitHub from now on, ok?)

Marius Gedminas (mgedmin) wrote :

Anyway this looks like fallout from http://bugs.python.org/issue22032, which showed up in 3.5.0 alpha 1 according to Misc/NEWS.

Changed in zope.testing:
status: New → Fix Committed

On Jun 23, 2015, at 05:34 AM, Marius Gedminas wrote:

>Anyway this looks like fallout from http://bugs.python.org/issue22032,
>which showed up in 3.5.0 alpha 1 according to Misc/NEWS.

Yep. With the PR I have it passing in my test PPA now.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.