This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Spurious unittest warnings
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: chris.jerdonek, ezio.melotti, flox, lukasz.langa, michael.foord, ned.deily
Priority: normal Keywords:

Created on 2012-07-07 15:22 by lukasz.langa, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg164872 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-07-07 15:22
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.
msg164881 - (view) Author: Florent Xicluna (flox) * (Python committer) Date: 2012-07-07 15:41
I cannot reproduce with 3.3 on Snow Leopard (default options, default compiler).

$ ./python.exe -m test.regrtest test_unittest
[1/1] test_unittest
1 test OK.
[158600 refs]


== CPython 3.3.0b1 (tip:9807de61191c, Jul 7 2012, 10:54:30) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
==   Darwin-10.8.0-i386-64bit little-endian
msg164883 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-07-07 15:43
Additional info that might help:

1. The command I'm using to build:

  MACOSX_DEPLOYMENT_TARGET=10.7 ./configure CC=gcc-apple-4.2 --with-pydebug

2. The test header in -v output:

  == CPython 3.3.0b1 (default:2e9cba1d1554, Jul 7 2012, 16:17:21) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3) (MacPorts apple-gcc42 5666.3_7)]
  ==   Darwin-11.4.0-x86_64-i386-64bit little-endian
  ==   /Users/ambv/Documents/Projekty/Python/cpython/py33/build/test_python_3894
  Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
msg164944 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2012-07-07 21:42
That's an odd failure.  I've not seen it nor can I reproduce it on 10.7 using the standard Apple Xcode 4.3.3 clang nor on 10.6 using the Apple Xcode 3.2.6 gcc-4.2.  You appear to be using a MacPorts-built gcc-4.2.  Can you try with an Apple-supplied compiler (./configure will now use clang by default for 10.7, avoid the use of Apple's llvm-gcc)?  Anything else in your environment that might be non-standard?
msg165072 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2012-07-09 08:26
Unfortunately, exactly the same thing happens with

    == CPython 3.3.0b1 (default:464c6a50b0ce, Jul 9 2012, 09:26:07) [GCC 4.2.1 Compatible Apple Clang 3.1 (tags/Apple/clang-318.0.61)]
    ==   Darwin-11.4.0-x86_64-i386-64bit little-endian
    ==   /Users/ambv/Documents/Projekty/Python/cpython/py33/build/test_python_37987
    Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)

What's interesting is that test_warnings itself works as advertised and it's only Lib/unittest/test/_test_warnings.py that misbehaves.

On my friend's 10.7 machine everything runs fine with a little older Clang:

    == CPython 3.3.0b1 (default, Jul 9 2012, 09:52:57) [GCC 4.2.1 Compatible Apple Clang 3.0 (tags/Apple/clang-211.12)]
    ==   Darwin-11.4.0-x86_64-i386-64bit little-endian
    ==   /Users/sheep/dev/python/cpython-464c6a50b0ce/build/test_python_7695
    Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)

Will investigate further.
msg227562 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-09-25 18:03
Is this still an issue?
msg230462 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2014-11-01 22:02
I'm going to close this.
If someone can reproduce it again, feel free to reopen it.
History
Date User Action Args
2022-04-11 14:57:32adminsetgithub: 59484
2014-11-01 22:02:06ezio.melottisetstatus: open -> closed
resolution: out of date
messages: + msg230462

stage: needs patch -> resolved
2014-09-25 18:03:17ezio.melottisetmessages: + msg227562
2012-07-09 10:55:54chris.jerdoneksetnosy: + chris.jerdonek
2012-07-09 08:26:08lukasz.langasetmessages: + msg165072
2012-07-07 21:42:16ned.deilysetnosy: + ned.deily
messages: + msg164944
2012-07-07 15:43:27lukasz.langasetmessages: + msg164883
2012-07-07 15:41:01floxsetnosy: + flox
messages: + msg164881
2012-07-07 15:26:11ezio.melottisetnosy: + ezio.melotti
2012-07-07 15:22:25lukasz.langacreate