Terry J. Reedy added the comment: The patch applies cleanly on my 3.4 Win 7, fresh debug build. Somewhat fortuitously, as it turns out, I have not downloaded the files needed for ssl support. For each modified file, I ran python_d -m test -v test_xxx
test test_nntplib crashed -- Traceback (most recent call last): File "F:\Python\dev\py34\lib\test\regrtest.py", line 1298, in runtest_inner the_module = importlib.import_module(abstest) File "F:\Python\dev\py34\lib\importlib\__init__.py", line 93, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1613, in _gcd_import File "<frozen importlib._bootstrap>", line 1594, in _find_and_load File "<frozen importlib._bootstrap>", line 1561, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 607, in _check_name_wrapper File "<frozen importlib._bootstrap>", line 1056, in load_module File "<frozen importlib._bootstrap>", line 926, in load_module File "<frozen importlib._bootstrap>", line 274, in _call_with_frames_removed File "F:\Python\dev\py34\lib\test\test_nntplib.py", line 305, in <module> class NetworkedNNTP_SSLTests(NetworkedNNTPTests): File "F:\Python\dev\py34\lib\test\test_nntplib.py", line 315, in NetworkedNNTP_SSLTests NNTP_CLASS = nntplib.NNTP_SSL AttributeError: 'module' object has no attribute 'NNTP_SSL' I do not understand the frozen importlib stuff, but nntplib._have_ssl is False, so the line asking for the non-existent attribute should not be executed. The problem is that changing a guard from 'if hasattr' to the decorator is a *semantic change* in that it allows execution of the guarded statement. Skips only skip function calling. For a function statement, creating a function object from the compiled code object and binding a name is trivial. Not calling the function is the important part. For a class with code other than function definitions, the difference is crucial, as the above shows. The general solution is to put class code inside a function so it is only executed later, as part of the test process, rather than during inport. @classmethod def setUpClass(cls): cls.NNTP_CLASS = nntplib.NNTP_SSL In this case, you could instead guard it with 'if _have_ssl', but since this assignment is the only thing being tested by this test case, it should be inside a method anyway. I suggest that you review your patch for other changed classes that might have class-level code that could fail with the change to the skip decorator. Here is similar problem: trying to subclass a class that does not exist. test test_socketserver crashed File "F:\Python\dev\py34\lib\test\test_socketserver.py", line 50, in <module> socketserver.UnixStreamServer): AttributeError: 'module' object has no attribute 'UnixStreamServer' class ForkingUnixStreamServer(socketserver.ForkingMixIn, socketserver.UnixStreamServer): pass I think you have to go back to 'if HAVE_UNIX_SOCKETS:' for this. Or re-factor somehow. --- I cannot help wondering whether test_math.xxx.test_exceptions should still be (normally) disabled. I sent Mark Dickinson a separate note. ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18702> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com