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: test_logging sometimes fails
Type: behavior Stage: needs patch
Components: Library (Lib), Tests Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: vinay.sajip Nosy List: benjamin.peterson, ezio.melotti, mark.dickinson, pitrou, vinay.sajip
Priority: high Keywords:

Created on 2009-12-29 21:18 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (6)
msg97005 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-12-29 21:18
test_logging sometimes fails with the following error, e.g. on the
buildbots (*):

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File
"/home/buildbot/cpython-ucs4/trunk.pitrou-ubuntu-wide/build/Lib/atexit.py",
line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File
"/home/buildbot/cpython-ucs4/trunk.pitrou-ubuntu-wide/build/Lib/logging/__init__.py",
line 1556, in shutdown
    h.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
Error in sys.exitfunc:
Traceback (most recent call last):
  File
"/home/buildbot/cpython-ucs4/trunk.pitrou-ubuntu-wide/build/Lib/atexit.py",
line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File
"/home/buildbot/cpython-ucs4/trunk.pitrou-ubuntu-wide/build/Lib/logging/__init__.py",
line 1556, in shutdown
    h.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
[874213 refs]


(*)
http://www.python.org/dev/buildbot/all/builders/AMD64%20Ubuntu%20wide%20trunk/builds/185/steps/test/logs/stdio
msg97006 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-12-29 21:18
Also: 
http://www.python.org/dev/buildbot/all/builders/x86%20Ubuntu%20trunk/builds/182/steps/test/logs/stdio
msg97043 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-30 17:07
I can reproduce this on OS X 10.6 with:

./python.exe Lib/test/regrtest.py test_lib2to3 test_logging

The failure doesn't happen if I run these two tests in the opposite order.
msg97044 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2009-12-30 17:13
r77106 seems to be the change that triggered this.  Benjamin, any ideas?
msg97045 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-12-30 17:17
> I can reproduce this on OS X 10.6 with:
> 
> ./python.exe Lib/test/regrtest.py test_lib2to3 test_logging

Same here!
The failure report in verbose mode is:

======================================================================
FAIL: test_filter (test.test_logging.BasicFilterTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 290, in test_filter
    ('spam.eggs.fish', 'INFO', '3'),
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 114, in assert_log_lines
    self.assertEquals(len(actual_lines), len(expected_values))
AssertionError: 4 != 2

======================================================================
FAIL: test_handler_filter (test.test_logging.CustomLevelsAndFiltersTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 390, in test_handler_filter
    ('Silent', '10'),
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 114, in assert_log_lines
    self.assertEquals(len(actual_lines), len(expected_values))
AssertionError: 10 != 5

======================================================================
FAIL: test_specific_filters (test.test_logging.CustomLevelsAndFiltersTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 416, in test_specific_filters
    self.assert_log_lines(first_lines)
  File "/home/antoine/py3k/__svn__/Lib/test/test_logging.py", line 114, in assert_log_lines
    self.assertEquals(len(actual_lines), len(expected_values))
AssertionError: 10 != 9

----------------------------------------------------------------------
msg97056 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-12-30 19:46
Fixed in r77158.
History
Date User Action Args
2022-04-11 14:56:55adminsetgithub: 51845
2009-12-31 04:26:53ezio.melottisetnosy: + ezio.melotti
2009-12-30 19:46:10benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg97056
2009-12-30 17:17:42pitrousetmessages: + msg97045
2009-12-30 17:13:33mark.dickinsonsetnosy: + benjamin.peterson
messages: + msg97044
2009-12-30 17:07:38mark.dickinsonsetnosy: + mark.dickinson
messages: + msg97043
2009-12-29 21:18:45pitrousetmessages: + msg97006
2009-12-29 21:18:02pitroucreate