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: Coverage influence tests, make some of them fail
Type: behavior Stage: patch review
Components: Tests Versions: Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, nedbat, patriki, r.david.murray, serhiy.storchaka
Priority: low Keywords: patch

Created on 2016-12-22 11:56 by patriki, last changed 2022-04-11 14:58 by admin.

Files
File name Uploaded Description Edit
coverity-tests-warnings.patch serhiy.storchaka, 2016-12-22 13:46 review
no-stderr.diff patriki, 2016-12-24 17:09 review
Messages (19)
msg283828 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-22 11:56
I checkout the latest tip from scratch.

When i run the tests i get the following results:
% ./python -m test -j
[...]
376 tests OK.

1 test altered the execution environment:
    test_site

27 tests skipped:
    test_bz2 test_ctypes test_curses test_dbm_gnu test_dbm_ndbm
    test_devpoll test_gdb test_kqueue test_lzma test_msilib
    test_ossaudiodev test_readline test_smtpnet test_socketserver
    test_sqlite test_startfile test_timeout test_tix test_tk
    test_ttk_guionly test_urllib2net test_urllibnet test_winconsoleio
    test_winreg test_winsound test_xmlrpc_net test_zipfile64

Total duration: 2 min 57 sec
Tests result: SUCCESS

Without any changes i run the tests again but this time under coverage. I get a completely different result:
% ./python ../coveragepy run --pylib Lib/test/regrtest.py
[...]
328 tests OK.

8 tests failed:
    test_exceptions test_frame test_ssl test_subprocess test_super
    test_traceback test_unittest test_xml_etree_c

41 tests altered the execution environment:
    test_asynchat test_asyncio test_asyncore test_capi
    test_concurrent_futures test_decimal test_distutils test_docxmlrpc
    test_email test_fork1 test_ftplib test_functools test_gc
    test_hashlib test_httplib test_httpservers test_imaplib
    test_import test_io test_json test_logging test_mailbox
    test_multiprocessing_fork test_multiprocessing_forkserver
    test_multiprocessing_spawn test_nntplib test_os test_poll
    test_poplib test_pydoc test_queue test_robotparser test_sched
    test_smtplib test_socket test_sys test_telnetlib
    test_threaded_import test_threadedtempfile test_threading
    test_xml_etree

27 tests skipped:
    test_bz2 test_ctypes test_curses test_dbm_gnu test_dbm_ndbm
    test_devpoll test_gdb test_kqueue test_lzma test_msilib
    test_ossaudiodev test_readline test_smtpnet test_socketserver
    test_sqlite test_startfile test_timeout test_tix test_tk
    test_ttk_guionly test_urllib2net test_urllibnet test_winconsoleio
    test_winreg test_winsound test_xmlrpc_net test_zipfile64

Total duration: 92 min 34 sec
Tests result: FAILURE

Is the reason for this difference known? Coverage shouldn't affect the outcome of the tests right?
msg283833 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-12-22 13:25
Ideally it should not, so these would be interesting bugs to investigate.
msg283837 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-12-22 13:46
Following patch fixes failures in test_ssl and test_subprocess.
msg283838 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-22 13:47
Are the tests that altered the execution environment something to bother with at all? Perhaps something for another issue?
msg283840 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-22 14:07
The fixes for test_ssl and test_subprocess seem strange to me. All they do is sweep the messages under the rug. Then there is not really any point with the 'with' block, is there?

Without coverage those tests passed so i cannot really see how this adds up.
msg283944 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 11:43
As an example, the difference for test_exceptions:

$ ./python ../coveragepy run --pylib --source=exceptions Lib/test/regrtest.py test_exceptions
Run tests sequentially
0:00:00 [1/1] test_exceptions
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenDel object at 0x7f9feefc1c88>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel object at 0x7f9feefc3d58>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1034, in __del__
    raise exc
test.test_exceptions.BrokenStrException: <exception str() failed>
test test_exceptions failed -- multiple errors occurred; run in verbose mode for details
test_exceptions failed

1 test failed:
    test_exceptions

Total duration: 1 sec
Tests result: FAILURE
Coverage.py warning: Module exceptions was never imported.
Coverage.py warning: No data was collected.



$ ./python -m test -v test_exceptions
== CPython 3.7.0a0 (default:8e311f109b22, Dec 24 2016, 12:26:43) [GCC 5.4.0 20160609]
==   Linux-4.4.0-53-generic-x86_64-with-debian-stretch-sid little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /home/irina/patrik/cpython/build/test_python_17521
==  encodings: locale=UTF-8, FS=utf-8
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, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_exceptions
testAttributes (test.test_exceptions.ExceptionTests) ... ok
testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
testRaising (test.test_exceptions.ExceptionTests) ... ok
testSettingException (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
test_3114 (test.test_exceptions.ExceptionTests) ... ok
test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests) ... ok
test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests) ... ok
test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_str (test.test_exceptions.ExceptionTests) ... ok
test_unhandled (test.test_exceptions.ExceptionTests) ... ok
test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ... ok
test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
test_unraisable (test.test_exceptions.ExceptionTests) ... ok
test_windows_message (test.test_exceptions.ExceptionTests)
Should fill in unknown error code in Windows error message ... skipped 'test specific to Windows'
test_attributes (test.test_exceptions.ImportErrorTests) ... ok
test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
test_reset_attributes (test.test_exceptions.ImportErrorTests) ... ok

----------------------------------------------------------------------
Ran 44 tests in 0.156s

OK (skipped=1)
1 test OK.

Total duration: 302 ms
Tests result: SUCCESS
msg283945 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 12:05
I've been looking into test_exceptions, why it fails. The reason seems to be that when the tests are executed under coverage, then they get nothing on the line that says the following in test_unraisable().

```python
report = stderr.getvalue()
```
So coverage steal strerr in this case, and the test's thunder.

A way to get around this would be to not let the test rely in stderr but instead catch the exception and unfold it as a string for testing.
msg283947 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2016-12-24 12:51
I doubt very very much that coverage.py is stealing stderr.  Many many test suites would have this problem if that were true.  More likely is that somehow __del__ is not being invoked when you need it to be.

I tried running the tests under coverage also, and did not see this behavior. I don't have a build tree of the latest code, but I ran it on 3.6.0.  The tests passed both with and without coverage measurement (output below).  I would like to understand why you are seeing the results you are.

$ mkvirtualenv -p python3.6 issue29048
Running virtualenv with interpreter /usr/local/bin/python3.6
Using base prefix '/usr/local/pythonz/pythons/CPython-3.6.0'
New python executable in issue29048/bin/python3.6
Also creating executable in issue29048/bin/python
Installing setuptools, pip, wheel...done.
Collecting pip
  Using cached pip-9.0.1-py2.py3-none-any.whl
Collecting setuptools
  Using cached setuptools-32.2.0-py2.py3-none-any.whl
Installing collected packages: pip, setuptools
  Found existing installation: pip 7.1.2
    Uninstalling pip-7.1.2:
      Successfully uninstalled pip-7.1.2
  Found existing installation: setuptools 18.2
    Uninstalling setuptools-18.2:
      Successfully uninstalled setuptools-18.2
Successfully installed pip-9.0.1 setuptools-32.2.0
(issue29048)$ pip install coverage
Collecting coverage
Installing collected packages: coverage
Successfully installed coverage-4.2
(issue29048)$ python3.6 -m test -v test_exceptions
== CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
==   Darwin-14.5.0-x86_64-i386-64bit little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp/T/test_python_20266
==  encodings: locale=UTF-8, FS=utf-8
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, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_exceptions
testAttributes (test.test_exceptions.ExceptionTests) ... ok
testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
testRaising (test.test_exceptions.ExceptionTests) ... ok
testSettingException (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
test_3114 (test.test_exceptions.ExceptionTests) ... ok
test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests) ... ok
test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests) ... ok
test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_str (test.test_exceptions.ExceptionTests) ... ok
test_unhandled (test.test_exceptions.ExceptionTests) ... ok
test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ... ok
test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
test_unraisable (test.test_exceptions.ExceptionTests) ... ok
test_windows_message (test.test_exceptions.ExceptionTests)
Should fill in unknown error code in Windows error message ... skipped 'test specific to Windows'
test_attributes (test.test_exceptions.ImportErrorTests) ... ok
test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok

----------------------------------------------------------------------
Ran 43 tests in 0.027s

OK (skipped=1)
1 test OK.

Total duration: 64 ms
Tests result: SUCCESS
(issue29048)$ python -m coverage run --pylib -m test -v test_exceptions
== CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
==   Darwin-14.5.0-x86_64-i386-64bit little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp/T/test_python_20270
==  encodings: locale=UTF-8, FS=utf-8
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, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_exceptions
testAttributes (test.test_exceptions.ExceptionTests) ... ok
testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
testRaising (test.test_exceptions.ExceptionTests) ... ok
testSettingException (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
test_3114 (test.test_exceptions.ExceptionTests) ... ok
test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests) ... ok
test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests) ... ok
test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_str (test.test_exceptions.ExceptionTests) ... ok
test_unhandled (test.test_exceptions.ExceptionTests) ... ok
test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ... ok
test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
test_unraisable (test.test_exceptions.ExceptionTests) ... ok
test_windows_message (test.test_exceptions.ExceptionTests)
Should fill in unknown error code in Windows error message ... skipped 'test specific to Windows'
test_attributes (test.test_exceptions.ImportErrorTests) ... ok
test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok

----------------------------------------------------------------------
Ran 43 tests in 0.036s

OK (skipped=1)
1 test OK.

Total duration: 95 ms
Tests result: SUCCESS
(issue29048)$ python -m coverage report
Name                                                                                       Stmts   Miss  Cover
--------------------------------------------------------------------------------------------------------------
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_bootlocale.py                         17     13    24%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_collections_abc.py                   562    546     3%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_osx_support.py                       210    161    23%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_sysconfigdata_m_darwin_darwin.py       1      0   100%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_weakrefset.py                        146    109    25%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/abc.py                                 92     65    29%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/argparse.py                          1187    757    36%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/base64.py                             315    268    15%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/codecs.py                             398    377     5%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/collections/__init__.py               677    650     4%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/contextlib.py                         163    140    14%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/difflib.py                            669    606     9%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/__init__.py                      14      8    43%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/base64mime.py                    40     26    35%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/charset.py                      122     78    36%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/encoders.py                      28     19    32%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/errors.py                        37      7    81%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/header.py                       310    258    17%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/quoprimime.py                   115     83    28%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/encodings/__init__.py                  76     43    43%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/encodings/latin_1.py                   19     18     5%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/enum.py                               438    248    43%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/functools.py                          443    421     5%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/genericpath.py                         72     50    31%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gettext.py                            389    323    17%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gzip.py                               349    298    15%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/__init__.py                  99     96     3%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/_bootstrap.py               631    445    29%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/_bootstrap_external.py      711    528    26%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/util.py                     147    140     5%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ipaddress.py                          904    597    34%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/linecache.py                          102     55    46%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/locale.py                             399    357    11%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/logging/__init__.py                   769    521    32%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/logging/handlers.py                   663    534    19%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/lzma.py                               135    130     4%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/multiprocessing/process.py            163    162     1%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/nntplib.py                            559    457    18%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/os.py                                 536    489     9%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/platform.py                           580    466    20%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/posixpath.py                          320    222    31%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/pprint.py                             419    351    16%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/queue.py                              111     76    32%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/quopri.py                             168    150    11%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/random.py                             346    329     5%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/re.py                                 153    125    18%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/shutil.py                             619    600     3%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/socket.py                             403    396     2%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_compile.py                        401    151    62%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_parse.py                          758    460    39%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ssl.py                                571    426    25%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/string.py                             153    114    25%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/subprocess.py                         794    671    15%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sysconfig.py                          376    246    35%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tempfile.py                           395    258    35%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__init__.py                        0      0   100%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__main__.py                        2      0   100%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/__init__.py            3      0   100%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/cmdline.py           127     52    59%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/main.py              335    163    51%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/refleak.py           186    122    34%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/runtest.py           146     62    58%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/save_env.py          189     68    64%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/setup.py              68     21    69%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/support/__init__.py             1289    902    30%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/test_exceptions.py               765     93    88%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/threading.py                          575    572     1%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tokenize.py                           473    438     7%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/traceback.py                          247    185    25%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/types.py                              155    152     2%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/__init__.py                   15      3    80%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/case.py                      753    413    45%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/loader.py                    295    226    23%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/main.py                      149    122    18%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/result.py                    128     66    48%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/runner.py                    159     51    68%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/signals.py                    47     33    30%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/suite.py                     220     81    63%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/util.py                      130    107    18%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/__init__.py                      0      0   100%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/error.py                        34     19    44%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/response.py                     43     26    40%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/warnings.py                           331    300     9%
/usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/weakref.py                            379    342    10%
--------------------------------------------------------------------------------------------------------------
TOTAL                                                                                      26517  19743    26%
(issue29048)$
msg283957 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 15:39
i use the latest code. perhaps something for introduced after 3.6?

Patrik

Den 24 dec 2016 13:51 skrev "Ned Batchelder" <report@bugs.python.org>:

>
> Ned Batchelder added the comment:
>
> I doubt very very much that coverage.py is stealing stderr.  Many many
> test suites would have this problem if that were true.  More likely is that
> somehow __del__ is not being invoked when you need it to be.
>
> I tried running the tests under coverage also, and did not see this
> behavior. I don't have a build tree of the latest code, but I ran it on
> 3.6.0.  The tests passed both with and without coverage measurement (output
> below).  I would like to understand why you are seeing the results you are.
>
> $ mkvirtualenv -p python3.6 issue29048
> Running virtualenv with interpreter /usr/local/bin/python3.6
> Using base prefix '/usr/local/pythonz/pythons/CPython-3.6.0'
> New python executable in issue29048/bin/python3.6
> Also creating executable in issue29048/bin/python
> Installing setuptools, pip, wheel...done.
> Collecting pip
>   Using cached pip-9.0.1-py2.py3-none-any.whl
> Collecting setuptools
>   Using cached setuptools-32.2.0-py2.py3-none-any.whl
> Installing collected packages: pip, setuptools
>   Found existing installation: pip 7.1.2
>     Uninstalling pip-7.1.2:
>       Successfully uninstalled pip-7.1.2
>   Found existing installation: setuptools 18.2
>     Uninstalling setuptools-18.2:
>       Successfully uninstalled setuptools-18.2
> Successfully installed pip-9.0.1 setuptools-32.2.0
> (issue29048)$ pip install coverage
> Collecting coverage
> Installing collected packages: coverage
> Successfully installed coverage-4.2
> (issue29048)$ python3.6 -m test -v test_exceptions
> == CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible
> Apple LLVM 7.0.2 (clang-700.1.81)]
> ==   Darwin-14.5.0-x86_64-i386-64bit little-endian
> ==   hash algorithm: siphash24 64bit
> ==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp
> /T/test_python_20266
> ==  encodings: locale=UTF-8, FS=utf-8
> 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, isolated=0)
> Run tests sequentially
> 0:00:00 [1/1] test_exceptions
> testAttributes (test.test_exceptions.ExceptionTests) ... ok
> testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
> testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
> testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
> testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
> testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
> testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
> testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
> testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
> testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
> testRaising (test.test_exceptions.ExceptionTests) ... ok
> testSettingException (test.test_exceptions.ExceptionTests) ... ok
> testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
> testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
> testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
> test_3114 (test.test_exceptions.ExceptionTests) ... ok
> test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
> test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
> test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
> test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
> test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests)
> ... ok
> test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
> test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> test_str (test.test_exceptions.ExceptionTests) ... ok
> test_unhandled (test.test_exceptions.ExceptionTests) ... ok
> test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ...
> ok
> test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
> test_unraisable (test.test_exceptions.ExceptionTests) ... ok
> test_windows_message (test.test_exceptions.ExceptionTests)
> Should fill in unknown error code in Windows error message ... skipped
> 'test specific to Windows'
> test_attributes (test.test_exceptions.ImportErrorTests) ... ok
> test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
>
> ----------------------------------------------------------------------
> Ran 43 tests in 0.027s
>
> OK (skipped=1)
> 1 test OK.
>
> Total duration: 64 ms
> Tests result: SUCCESS
> (issue29048)$ python -m coverage run --pylib -m test -v test_exceptions
> == CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible
> Apple LLVM 7.0.2 (clang-700.1.81)]
> ==   Darwin-14.5.0-x86_64-i386-64bit little-endian
> ==   hash algorithm: siphash24 64bit
> ==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp
> /T/test_python_20270
> ==  encodings: locale=UTF-8, FS=utf-8
> 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, isolated=0)
> Run tests sequentially
> 0:00:00 [1/1] test_exceptions
> testAttributes (test.test_exceptions.ExceptionTests) ... ok
> testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
> testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
> testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
> testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
> testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
> testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
> testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
> testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
> testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
> testRaising (test.test_exceptions.ExceptionTests) ... ok
> testSettingException (test.test_exceptions.ExceptionTests) ... ok
> testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
> testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
> testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
> test_3114 (test.test_exceptions.ExceptionTests) ... ok
> test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
> test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
> test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
> test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
> test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests)
> ... ok
> test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
> test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
> test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests)
> ... ok
> test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> test_str (test.test_exceptions.ExceptionTests) ... ok
> test_unhandled (test.test_exceptions.ExceptionTests) ... ok
> test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ...
> ok
> test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
> test_unraisable (test.test_exceptions.ExceptionTests) ... ok
> test_windows_message (test.test_exceptions.ExceptionTests)
> Should fill in unknown error code in Windows error message ... skipped
> 'test specific to Windows'
> test_attributes (test.test_exceptions.ImportErrorTests) ... ok
> test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
>
> ----------------------------------------------------------------------
> Ran 43 tests in 0.036s
>
> OK (skipped=1)
> 1 test OK.
>
> Total duration: 95 ms
> Tests result: SUCCESS
> (issue29048)$ python -m coverage report
> Name
>                  Stmts   Miss  Cover
> ------------------------------------------------------------
> --------------------------------------------------
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_bootlocale.py
>                      17     13    24%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_collections_abc.py
>                  562    546     3%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_osx_support.py
>                    210    161    23%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_
> sysconfigdata_m_darwin_darwin.py       1      0   100%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_weakrefset.py
>                     146    109    25%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/abc.py
>                      92     65    29%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/argparse.py
>                   1187    757    36%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/base64.py
>                    315    268    15%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/codecs.py
>                    398    377     5%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/collections/__init__.py
>              677    650     4%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/contextlib.py
>                    163    140    14%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/difflib.py
>                     669    606     9%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/__init__.py
>                     14      8    43%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/base64mime.py
>                   40     26    35%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/charset.py
>                     122     78    36%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/encoders.py
>                     28     19    32%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/errors.py
>                     37      7    81%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/header.py
>                    310    258    17%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/quoprimime.py
>                  115     83    28%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/encodings/__init__.py
>                 76     43    43%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/encodings/latin_1.py
>                  19     18     5%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/enum.py
>                    438    248    43%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/functools.py
>                     443    421     5%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/genericpath.py
>                      72     50    31%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gettext.py
>                     389    323    17%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gzip.py
>                    349    298    15%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/__init__.py
>                 99     96     3%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/_bootstrap.py
>              631    445    29%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> importlib/_bootstrap_external.py      711    528    26%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/util.py
>                    147    140     5%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ipaddress.py
>                     904    597    34%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/linecache.py
>                     102     55    46%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/locale.py
>                    399    357    11%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/logging/__init__.py
>                  769    521    32%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/logging/handlers.py
>                  663    534    19%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/lzma.py
>                    135    130     4%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/multiprocessing/process.py
>           163    162     1%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/nntplib.py
>                     559    457    18%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/os.py
>                    536    489     9%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/platform.py
>                    580    466    20%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/posixpath.py
>                     320    222    31%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/pprint.py
>                    419    351    16%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/queue.py
>                     111     76    32%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/quopri.py
>                    168    150    11%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/random.py
>                    346    329     5%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/re.py
>                    153    125    18%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/shutil.py
>                    619    600     3%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/socket.py
>                    403    396     2%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_compile.py
>                     401    151    62%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_parse.py
>                     758    460    39%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ssl.py
>                     571    426    25%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/string.py
>                    153    114    25%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/subprocess.py
>                    794    671    15%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sysconfig.py
>                     376    246    35%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tempfile.py
>                    395    258    35%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__init__.py
>                       0      0   100%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__main__.py
>                       2      0   100%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/__init__.py
>           3      0   100%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/cmdline.py
>          127     52    59%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/main.py
>             335    163    51%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/refleak.py
>          186    122    34%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/runtest.py
>          146     62    58%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/save_env.py
>         189     68    64%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/libregrtest/setup.py
>             68     21    69%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/support/__init__.py
>            1289    902    30%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/test_exceptions.py
>              765     93    88%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/threading.py
>                     575    572     1%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tokenize.py
>                    473    438     7%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/traceback.py
>                     247    185    25%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/types.py
>                     155    152     2%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/__init__.py
>                  15      3    80%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/case.py
>                     753    413    45%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/loader.py
>                   295    226    23%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/main.py
>                     149    122    18%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/result.py
>                   128     66    48%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/runner.py
>                   159     51    68%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/signals.py
>                   47     33    30%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/suite.py
>                    220     81    63%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/util.py
>                     130    107    18%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/__init__.py
>                     0      0   100%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/error.py
>                     34     19    44%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/response.py
>                    43     26    40%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/warnings.py
>                    331    300     9%
> /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/weakref.py
>                     379    342    10%
> ------------------------------------------------------------
> --------------------------------------------------
> TOTAL
>                 26517  19743    26%
> (issue29048)$
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue29048>
> _______________________________________
>
msg283958 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 16:28
report doesn't contain any text when run under coverage. something made the
text not appear...

Patrik

Den 24 dec 2016 16:39 skrev "Patrik Iselind" <report@bugs.python.org>:

>
> Patrik Iselind added the comment:
>
> i use the latest code. perhaps something for introduced after 3.6?
>
> Patrik
>
> Den 24 dec 2016 13:51 skrev "Ned Batchelder" <report@bugs.python.org>:
>
> >
> > Ned Batchelder added the comment:
> >
> > I doubt very very much that coverage.py is stealing stderr.  Many many
> > test suites would have this problem if that were true.  More likely is
> that
> > somehow __del__ is not being invoked when you need it to be.
> >
> > I tried running the tests under coverage also, and did not see this
> > behavior. I don't have a build tree of the latest code, but I ran it on
> > 3.6.0.  The tests passed both with and without coverage measurement
> (output
> > below).  I would like to understand why you are seeing the results you
> are.
> >
> > $ mkvirtualenv -p python3.6 issue29048
> > Running virtualenv with interpreter /usr/local/bin/python3.6
> > Using base prefix '/usr/local/pythonz/pythons/CPython-3.6.0'
> > New python executable in issue29048/bin/python3.6
> > Also creating executable in issue29048/bin/python
> > Installing setuptools, pip, wheel...done.
> > Collecting pip
> >   Using cached pip-9.0.1-py2.py3-none-any.whl
> > Collecting setuptools
> >   Using cached setuptools-32.2.0-py2.py3-none-any.whl
> > Installing collected packages: pip, setuptools
> >   Found existing installation: pip 7.1.2
> >     Uninstalling pip-7.1.2:
> >       Successfully uninstalled pip-7.1.2
> >   Found existing installation: setuptools 18.2
> >     Uninstalling setuptools-18.2:
> >       Successfully uninstalled setuptools-18.2
> > Successfully installed pip-9.0.1 setuptools-32.2.0
> > (issue29048)$ pip install coverage
> > Collecting coverage
> > Installing collected packages: coverage
> > Successfully installed coverage-4.2
> > (issue29048)$ python3.6 -m test -v test_exceptions
> > == CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible
> > Apple LLVM 7.0.2 (clang-700.1.81)]
> > ==   Darwin-14.5.0-x86_64-i386-64bit little-endian
> > ==   hash algorithm: siphash24 64bit
> > ==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp
> > /T/test_python_20266
> > ==  encodings: locale=UTF-8, FS=utf-8
> > 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, isolated=0)
> > Run tests sequentially
> > 0:00:00 [1/1] test_exceptions
> > testAttributes (test.test_exceptions.ExceptionTests) ... ok
> > testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
> > testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
> > testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
> > testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
> > testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
> > testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
> > testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
> > testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
> > testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
> > testRaising (test.test_exceptions.ExceptionTests) ... ok
> > testSettingException (test.test_exceptions.ExceptionTests) ... ok
> > testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
> > testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
> > testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
> > test_3114 (test.test_exceptions.ExceptionTests) ... ok
> > test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
> > test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
> > test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
> > test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
> > test_exception_target_in_nested_scope (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_close_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_del_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_doesnt_retain_old_exc (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_finalizing_and_exc_info (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_next_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_send_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_throw_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> > test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ...
> ok
> > test_str (test.test_exceptions.ExceptionTests) ... ok
> > test_unhandled (test.test_exceptions.ExceptionTests) ... ok
> > test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ...
> > ok
> > test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ...
> ok
> > test_unraisable (test.test_exceptions.ExceptionTests) ... ok
> > test_windows_message (test.test_exceptions.ExceptionTests)
> > Should fill in unknown error code in Windows error message ... skipped
> > 'test specific to Windows'
> > test_attributes (test.test_exceptions.ImportErrorTests) ... ok
> > test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
> >
> > ----------------------------------------------------------------------
> > Ran 43 tests in 0.027s
> >
> > OK (skipped=1)
> > 1 test OK.
> >
> > Total duration: 64 ms
> > Tests result: SUCCESS
> > (issue29048)$ python -m coverage run --pylib -m test -v test_exceptions
> > == CPython 3.6.0 (default, Dec 23 2016, 07:11:25) [GCC 4.2.1 Compatible
> > Apple LLVM 7.0.2 (clang-700.1.81)]
> > ==   Darwin-14.5.0-x86_64-i386-64bit little-endian
> > ==   hash algorithm: siphash24 64bit
> > ==  cwd: /private/var/folders/j2/gr3cj3jn63s5q8g3bjvw57hm0000gp
> > /T/test_python_20270
> > ==  encodings: locale=UTF-8, FS=utf-8
> > 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, isolated=0)
> > Run tests sequentially
> > 0:00:00 [1/1] test_exceptions
> > testAttributes (test.test_exceptions.ExceptionTests) ... ok
> > testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
> > testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
> > testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
> > testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
> > testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
> > testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
> > testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
> > testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
> > testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
> > testRaising (test.test_exceptions.ExceptionTests) ... ok
> > testSettingException (test.test_exceptions.ExceptionTests) ... ok
> > testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
> > testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
> > testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
> > test_3114 (test.test_exceptions.ExceptionTests) ... ok
> > test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
> > test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
> > test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
> > test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
> > test_exception_target_in_nested_scope (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_close_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_del_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_doesnt_retain_old_exc (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_finalizing_and_exc_info (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
> > test_generator_next_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_send_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_generator_throw_cleanup_exc_state (test.test_exceptions.
> ExceptionTests)
> > ... ok
> > test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
> > test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ...
> ok
> > test_str (test.test_exceptions.ExceptionTests) ... ok
> > test_unhandled (test.test_exceptions.ExceptionTests) ... ok
> > test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ...
> > ok
> > test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ...
> ok
> > test_unraisable (test.test_exceptions.ExceptionTests) ... ok
> > test_windows_message (test.test_exceptions.ExceptionTests)
> > Should fill in unknown error code in Windows error message ... skipped
> > 'test specific to Windows'
> > test_attributes (test.test_exceptions.ImportErrorTests) ... ok
> > test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
> >
> > ----------------------------------------------------------------------
> > Ran 43 tests in 0.036s
> >
> > OK (skipped=1)
> > 1 test OK.
> >
> > Total duration: 95 ms
> > Tests result: SUCCESS
> > (issue29048)$ python -m coverage report
> > Name
> >                  Stmts   Miss  Cover
> > ------------------------------------------------------------
> > --------------------------------------------------
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_bootlocale.py
> >                      17     13    24%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_
> collections_abc.py
> >                  562    546     3%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_osx_support.py
> >                    210    161    23%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_
> > sysconfigdata_m_darwin_darwin.py       1      0   100%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/_weakrefset.py
> >                     146    109    25%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/abc.py
> >                      92     65    29%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/argparse.py
> >                   1187    757    36%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/base64.py
> >                    315    268    15%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/codecs.py
> >                    398    377     5%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> collections/__init__.py
> >              677    650     4%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/contextlib.py
> >                    163    140    14%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/difflib.py
> >                     669    606     9%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/__init__.py
> >                     14      8    43%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> email/base64mime.py
> >                   40     26    35%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/charset.py
> >                     122     78    36%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/encoders.py
> >                     28     19    32%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/errors.py
> >                     37      7    81%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/email/header.py
> >                    310    258    17%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> email/quoprimime.py
> >                  115     83    28%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> encodings/__init__.py
> >                 76     43    43%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> encodings/latin_1.py
> >                  19     18     5%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/enum.py
> >                    438    248    43%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/functools.py
> >                     443    421     5%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/genericpath.py
> >                      72     50    31%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gettext.py
> >                     389    323    17%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/gzip.py
> >                    349    298    15%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> importlib/__init__.py
> >                 99     96     3%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> importlib/_bootstrap.py
> >              631    445    29%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> > importlib/_bootstrap_external.py      711    528    26%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/importlib/util.py
> >                    147    140     5%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ipaddress.py
> >                     904    597    34%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/linecache.py
> >                     102     55    46%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/locale.py
> >                    399    357    11%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> logging/__init__.py
> >                  769    521    32%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> logging/handlers.py
> >                  663    534    19%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/lzma.py
> >                    135    130     4%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> multiprocessing/process.py
> >           163    162     1%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/nntplib.py
> >                     559    457    18%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/os.py
> >                    536    489     9%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/platform.py
> >                    580    466    20%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/posixpath.py
> >                     320    222    31%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/pprint.py
> >                    419    351    16%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/queue.py
> >                     111     76    32%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/quopri.py
> >                    168    150    11%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/random.py
> >                    346    329     5%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/re.py
> >                    153    125    18%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/shutil.py
> >                    619    600     3%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/socket.py
> >                    403    396     2%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_compile.py
> >                     401    151    62%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sre_parse.py
> >                     758    460    39%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/ssl.py
> >                     571    426    25%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/string.py
> >                    153    114    25%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/subprocess.py
> >                    794    671    15%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/sysconfig.py
> >                     376    246    35%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tempfile.py
> >                    395    258    35%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__init__.py
> >                       0      0   100%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/test/__main__.py
> >                       2      0   100%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/__init__.py
> >           3      0   100%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/cmdline.py
> >          127     52    59%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/main.py
> >             335    163    51%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/refleak.py
> >          186    122    34%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/runtest.py
> >          146     62    58%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/save_env.py
> >         189     68    64%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/libregrtest/setup.py
> >             68     21    69%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/support/__init__.py
> >            1289    902    30%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> test/test_exceptions.py
> >              765     93    88%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/threading.py
> >                     575    572     1%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/tokenize.py
> >                    473    438     7%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/traceback.py
> >                     247    185    25%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/types.py
> >                     155    152     2%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> unittest/__init__.py
> >                  15      3    80%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/case.py
> >                     753    413    45%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> unittest/loader.py
> >                   295    226    23%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/main.py
> >                     149    122    18%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> unittest/result.py
> >                   128     66    48%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> unittest/runner.py
> >                   159     51    68%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> unittest/signals.py
> >                   47     33    30%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/suite.py
> >                    220     81    63%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/unittest/util.py
> >                     130    107    18%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> urllib/__init__.py
> >                     0      0   100%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/urllib/error.py
> >                     34     19    44%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/
> urllib/response.py
> >                    43     26    40%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/warnings.py
> >                    331    300     9%
> > /usr/local/pythonz/pythons/CPython-3.6.0/lib/python3.6/weakref.py
> >                     379    342    10%
> > ------------------------------------------------------------
> > --------------------------------------------------
> > TOTAL
> >                 26517  19743    26%
> > (issue29048)$
> >
> > ----------
> >
> > _______________________________________
> > Python tracker <report@bugs.python.org>
> > <http://bugs.python.org/issue29048>
> > _______________________________________
> >
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue29048>
> _______________________________________
>
msg283959 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2016-12-24 16:37
Are you sure the code that tried to print to stderr was even run? It's in a __del__ method, which is notorious for being affected by surprising things.
msg283960 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 16:40
yes, I'm sure. i printed markings around where the text should have been.

Patrik

Den 24 dec 2016 17:37 skrev "Ned Batchelder" <report@bugs.python.org>:

>
> Ned Batchelder added the comment:
>
> Are you sure the code that tried to print to stderr was even run? It's in
> a __del__ method, which is notorious for being affected by surprising
> things.
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue29048>
> _______________________________________
>
msg283962 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 17:09
For clarity, this is what i get in the test_exceptions test when i've applied the attached diff.

$ ./python -m test -v test_exceptions
== CPython 3.7.0a0 (default:8e311f109b22, Dec 24 2016, 12:26:43) [GCC 5.4.0 20160609]
==   Linux-4.4.0-53-generic-x86_64-with-debian-stretch-sid little-endian
==   hash algorithm: siphash24 64bit
==  cwd: /home/irina/patrik/cpython/build/test_python_19104
==  encodings: locale=UTF-8, FS=utf-8
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, isolated=0)
Run tests sequentially
0:00:00 [1/1] test_exceptions
testAttributes (test.test_exceptions.ExceptionTests) ... ok
testChainingAttrs (test.test_exceptions.ExceptionTests) ... ok
testChainingDescriptors (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupNames (test.test_exceptions.ExceptionTests) ... ok
testExceptionCleanupState (test.test_exceptions.ExceptionTests) ... ok
testInfiniteRecursion (test.test_exceptions.ExceptionTests) ... ok
testInvalidAttrs (test.test_exceptions.ExceptionTests) ... ok
testInvalidTraceback (test.test_exceptions.ExceptionTests) ... ok
testKeywordArgs (test.test_exceptions.ExceptionTests) ... ok
testNoneClearsTracebackAttr (test.test_exceptions.ExceptionTests) ... ok
testRaising (test.test_exceptions.ExceptionTests) ... ok
testSettingException (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorMessage (test.test_exceptions.ExceptionTests) ... ok
testSyntaxErrorOffset (test.test_exceptions.ExceptionTests) ... ok
testWithTraceback (test.test_exceptions.ExceptionTests) ... ok
test_3114 (test.test_exceptions.ExceptionTests) ... ok
test_MemoryError (test.test_exceptions.ExceptionTests) ... ok
test_WindowsError (test.test_exceptions.ExceptionTests) ... ok
test_badisinstance (test.test_exceptions.ExceptionTests) ... ok
test_errno_ENOTDIR (test.test_exceptions.ExceptionTests) ... ok
test_exception_target_in_nested_scope (test.test_exceptions.ExceptionTests) ... ok
test_exception_with_doc (test.test_exceptions.ExceptionTests) ... ok
test_generator_close_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_del_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_doesnt_retain_old_exc (test.test_exceptions.ExceptionTests) ... ok
test_generator_finalizing_and_exc_info (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking2 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking3 (test.test_exceptions.ExceptionTests) ... ok
test_generator_leaking4 (test.test_exceptions.ExceptionTests) ... ok
test_generator_next_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_send_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_generator_throw_cleanup_exc_state (test.test_exceptions.ExceptionTests) ... ok
test_memory_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_recursion_error_cleanup (test.test_exceptions.ExceptionTests) ... ok
test_str (test.test_exceptions.ExceptionTests) ... ok
test_unhandled (test.test_exceptions.ExceptionTests) ... ok
test_unicode_change_attributes (test.test_exceptions.ExceptionTests) ... ok
test_unicode_errors_no_object (test.test_exceptions.ExceptionTests) ... ok
test_unraisable (test.test_exceptions.ExceptionTests) ... BEGINBEGINBEGINBEGINBEGIN
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenDel object at 0x7f4313a41ef8>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken

ENDENDENDENDENDENDENDEND
BEGINBEGINBEGINBEGINBEGIN
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken

ENDENDENDENDENDENDENDEND
BEGINBEGINBEGINBEGINBEGIN
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel object at 0x7f4313a41ef8>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1034, in __del__
    raise exc
test.test_exceptions.BrokenStrException: <exception str() failed>

ENDENDENDENDENDENDENDEND
ok
test_windows_message (test.test_exceptions.ExceptionTests)
Should fill in unknown error code in Windows error message ... skipped 'test specific to Windows'
test_attributes (test.test_exceptions.ImportErrorTests) ... ok
test_non_str_argument (test.test_exceptions.ImportErrorTests) ... ok
test_reset_attributes (test.test_exceptions.ImportErrorTests) ... ok

----------------------------------------------------------------------
Ran 44 tests in 0.158s

OK (skipped=1)
1 test OK.

Total duration: 363 ms
Tests result: SUCCESS




$ ./python ../coveragepy run --pylib --source=exceptions Lib/test/regrtest.py test_exceptions
Run tests sequentially
0:00:00 [1/1] test_exceptions
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenDel object at 0x7f1c67de69b0>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken
BEGINBEGINBEGINBEGINBEGIN

ENDENDENDENDENDENDENDEND
Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1024, in __del__
    raise exc
ValueError: del is broken
BEGINBEGINBEGINBEGINBEGIN

ENDENDENDENDENDENDENDEND
Exception ignored in: <bound method ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel.__del__ of <test.test_exceptions.ExceptionTests.test_unraisable.<locals>.BrokenExceptionDel object at 0x7f1c67de6f60>>
Traceback (most recent call last):
  File "/home/irina/patrik/cpython/Lib/test/test_exceptions.py", line 1034, in __del__
    raise exc
test.test_exceptions.BrokenStrException: <exception str() failed>
BEGINBEGINBEGINBEGINBEGIN

ENDENDENDENDENDENDENDEND
test test_exceptions failed -- multiple errors occurred; run in verbose mode for details
test_exceptions failed

1 test failed:
    test_exceptions

Total duration: 1 sec
Tests result: FAILURE
Coverage.py warning: Module exceptions was never imported.
Coverage.py warning: No data was collected.



Somehow stuff is no longer ending up in stderr. That empty line is most likely the report that get printed when its value is "".
msg283963 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 17:13
I'd like to clarify that the file i just attached, no-stderr.diff, is in no way a suggestion for a fix. It's just my way of conveying what i see.
msg283967 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2016-12-24 18:14
Can you show the output of "coverage debug sys"?
msg283968 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 18:25
Sure, here you go.

$ ./python ../coveragepy debug sys
-- sys -------------------------------------------------------
              version: 4.3a0
             coverage: ../coveragepy/coverage/__init__.py
           cover_dirs: /home/irina/patrik/coveragepy/coverage
           pylib_dirs: /home/irina/patrik/cpython/Lib
               tracer: PyTracer
 plugins.file_tracers: -none-
         config_files: .coveragerc
                       setup.cfg
                       tox.ini
         configs_read: -none-
            data_path: /home/irina/patrik/cpython/.coverage
               python: 3.7.0a0 (default:7ceacac48cd2+, Dec 24 2016, 19:08:24) [GCC 5.4.0 20160609]
             platform: Linux-4.4.0-53-generic-x86_64-with-debian-stretch-sid
       implementation: CPython
           executable: /home/irina/patrik/cpython/python
                  cwd: /home/irina/patrik/cpython
                 path: 
                       /usr/local/lib/python37.zip
                       /home/irina/patrik/cpython/Lib
                       /home/irina/patrik/cpython/build/lib.linux-x86_64-3.7
          environment: -none-
         command_line: ../coveragepy/coverage/__main__.py debug sys
         source_match: -none-
    source_pkgs_match: -none-
        include_match: -none-
           omit_match: -none-
          cover_match: /home/irina/patrik/coveragepy/coverage
          pylib_match: /home/irina/patrik/cpython/Lib
msg283969 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 18:39
@nedbat, do you know of a revision where coverage doesn't influence the tests? If so, which one? Perhaps i can perform a bisect search to find when this went bad.

I'm testing the latest tip/head. So that's one part of the bisect.
msg283970 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2016-12-24 19:26
I don't believe this is coverage.py's fault, so I don't have an answer to your question.  There is no revision of coverage.py that *does* swallow stderr.  Also, as you can see from the test output, it isn't swallowed, it's not being captured where it should be captured, but it is appearing on the terminal.  I see more than 60 uses of captured_stderr in the Python test suite. If coverage.py were swallowing stderr, I would expect dozens of test failures.  The problem is more subtle.

If you want, you can bisect against any revision of coverage.py you like, perhaps the released 4.2?
msg283971 - (view) Author: Patrik Iselind (patriki) * Date: 2016-12-24 19:32
OK, for now. Let's disregard my idea that stderr is swallowed. At some
point these test might have worked under coverage.

I was more thinking to bisect cpython. Perhaps i can find a revision that
works.

Patrik

Den 24 dec 2016 20:26 skrev "Ned Batchelder" <report@bugs.python.org>:

>
> Ned Batchelder added the comment:
>
> I don't believe this is coverage.py's fault, so I don't have an answer to
> your question.  There is no revision of coverage.py that *does* swallow
> stderr.  Also, as you can see from the test output, it isn't swallowed,
> it's not being captured where it should be captured, but it is appearing on
> the terminal.  I see more than 60 uses of captured_stderr in the Python
> test suite. If coverage.py were swallowing stderr, I would expect dozens of
> test failures.  The problem is more subtle.
>
> If you want, you can bisect against any revision of coverage.py you like,
> perhaps the released 4.2?
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue29048>
> _______________________________________
>
History
Date User Action Args
2022-04-11 14:58:41adminsetgithub: 73234
2017-03-07 17:36:45brett.cannonsetnosy: + brett.cannon
2017-03-07 17:36:22brett.cannonlinkissue29691 superseder
2016-12-24 19:32:13patrikisetmessages: + msg283971
2016-12-24 19:26:47nedbatsetmessages: + msg283970
2016-12-24 18:39:57patrikisetmessages: + msg283969
2016-12-24 18:25:33patrikisetmessages: + msg283968
2016-12-24 18:14:41nedbatsetmessages: + msg283967
2016-12-24 17:13:29patrikisetmessages: + msg283963
2016-12-24 17:09:47patrikisetfiles: + no-stderr.diff

messages: + msg283962
2016-12-24 16:40:54patrikisetmessages: + msg283960
2016-12-24 16:37:31nedbatsetmessages: + msg283959
2016-12-24 16:28:21patrikisetmessages: + msg283958
2016-12-24 15:39:56patrikisetmessages: + msg283957
2016-12-24 12:51:08nedbatsetmessages: + msg283947
2016-12-24 12:05:35patrikisetmessages: + msg283945
2016-12-24 11:43:37patrikisetmessages: + msg283944
2016-12-22 16:06:10serhiy.storchakasetnosy: + nedbat
2016-12-22 14:07:21patrikisetmessages: + msg283840
2016-12-22 13:47:36patrikisetmessages: + msg283838
2016-12-22 13:46:24serhiy.storchakasetfiles: + coverity-tests-warnings.patch

nosy: + serhiy.storchaka
messages: + msg283837

keywords: + patch
stage: patch review
2016-12-22 13:25:12r.david.murraysetpriority: normal -> low
nosy: + r.david.murray
messages: + msg283833

2016-12-22 11:56:16patrikicreate