classification
Title: test_logging fails on Windows for Unix tests
Type: behavior Stage:
Components: Tests Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Claudiu.Popa, diana, python-dev, vinay.sajip, vstinner
Priority: normal Keywords: patch

Created on 2014-06-02 12:08 by Claudiu.Popa, last changed 2014-06-02 12:43 by vstinner. This issue is now closed.

Files
File name Uploaded Description Edit
logging_windows.patch Claudiu.Popa, 2014-06-02 12:08 review
Messages (6)
msg219572 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-06-02 12:08
Hello! The attached patch fixes a crash for the logging tests on Windows. That's because the tests assume that socket.AF_UNIX exists. The actual traceback is:

[1/1] test_logging
test test_logging crashed -- Traceback (most recent call last):
  File "D:\Projects\cpython\lib\test\regrtest.py", line 1271, in runtest_inner
    the_module = importlib.import_module(abstest)
  File "D:\Projects\cpython\lib\importlib\__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2203, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2186, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2175, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1149, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1420, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "D:\Projects\cpython\lib\test\test_logging.py", line 863, in <module>
    class TestUnixStreamServer(TestTCPServer):
  File "D:\Projects\cpython\lib\test\test_logging.py", line 864, in TestUnixStreamServer
    address_family = socket.AF_UNIX
AttributeError: module 'socket' has no attribute 'AF_UNIX'

1 test failed:
    test_logging
msg219575 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 12:25
Oh, it looks like a follow-up of the issue #21583 (change f1393e82660819996e74c7eeddc5ae1f38b15f0a), the test was already buggy but not run before.
msg219576 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 12:26
+    if threading and hasattr(socket, "AF_UNIX"):

The check on socket.AF_UNIX attribute looks redundant: there is already a decorator on the testcase class to skip the whole test case. No?
msg219578 - (view) Author: PCManticore (Claudiu.Popa) * (Python triager) Date: 2014-06-02 12:33
No, because the tests will be skipped after the assignment of the address family.
msg219580 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 12:40
> No, because the tests will be skipped after the assignment of the address family.

Ah yes, the body of the class is executed before the decorator.
msg219581 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-06-02 12:43
New changeset d7a491c6cbdb by Victor Stinner in branch '3.4':
Issue #21636: Fix test_logging, skip UNIX stream (AF_UNIX) tests on Windows.
http://hg.python.org/cpython/rev/d7a491c6cbdb

New changeset b49e366556ba by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21636: Fix test_logging, skip UNIX stream (AF_UNIX) tests on
http://hg.python.org/cpython/rev/b49e366556ba
History
Date User Action Args
2014-06-02 12:43:47vstinnersetstatus: open -> closed
resolution: fixed
2014-06-02 12:43:35python-devsetmessages: + msg219581
2014-06-02 12:40:41vstinnersetmessages: + msg219580
2014-06-02 12:33:10Claudiu.Popasetmessages: + msg219578
2014-06-02 12:26:42vstinnersetmessages: + msg219576
2014-06-02 12:25:35vstinnersetnosy: + vstinner, diana, python-dev

messages: + msg219575
versions: + Python 3.4
2014-06-02 12:08:05Claudiu.Popacreate