[New-bugs-announce] [issue15279] Spurious unittest warnings

Łukasz Langa report at bugs.python.org
Sat Jul 7 17:22:25 CEST 2012


New submission from Łukasz Langa <lukasz at langa.pl>:

On Mac OS X 10.7 64-bit unittest regression tests fail:


    ======================================================================
    FAIL: test_warnings (unittest.test.test_runner.Test_TextTestRunner)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/ambv/Documents/Projekty/Python/cpython/py33/Lib/unittest/test/test_runner.py", line 269, in test_warnings
        self.assertEqual(len(out), 12)
    AssertionError: 15 != 12

    ----------------------------------------------------------------------
    Ran 568 tests in 24.441s

    FAILED (failures=1, skipped=1)
    test test_unittest failed


It looks like warnings generated by unittest aren't properly limited to one for each distinct warning. Running _test_warnings.py directly shows that:

    $ ./python.exe Lib/unittest/test/_test_warnings.py
    .......
    ----------------------------------------------------------------------
    Ran 7 tests in 0.002s

    OK
    Please use assertEqual instead.
    Please use assertEqual instead.
    Please use assertEqual instead.
    dw
    dw
    dw
    Please use assertTrue instead.
    Please use assertTrue instead.
    rw
    iw
    iw
    iw
    uw
    uw
    uw
    [61188 refs]

The expected behaviour would be for each kind of the "Please use" warnings to only appear once.

----------
assignee: michael.foord
components: Library (Lib)
messages: 164872
nosy: lukasz.langa, michael.foord
priority: normal
severity: normal
stage: needs patch
status: open
title: Spurious unittest warnings
type: behavior
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15279>
_______________________________________


More information about the New-bugs-announce mailing list