msg235228 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-02-02 07:21 |
http://buildbot.python.org/all/builders/x86%20XP-4%202.7/builds/3092/steps/test/logs/stdio ====================================================================== FAIL: test_optional_module_removals (test.test_py3kwarn.TestStdlibRemovals) ---------------------------------------------------------------------- Traceback (most recent call last): File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_py3kwarn.py", line 395, in test_optional_module_removals self.check_removal(module_name, optional=True) File "D:\cygwin\home\db3l\buildarea\2.7.bolen-windows\build\lib\test\test_py3kwarn.py", line 379, in check_removal .format(module_name)) AssertionError: DeprecationWarning not raised for imageop ---------------------------------------------------------------------- |
|
|
msg235275 - (view) |
Author: Steve Dower (steve.dower) *  |
Date: 2015-02-02 17:24 |
Looks like a test ordering issue. When test_imageop runs before test_py3kwarn, the warning has presumably already been shown once and so isn't triggered when the test is looking for it (compare build 3092 linked above with 3093, which passed). I haven't looked any further into this, but I don't see how it's Windows specific. Adding the test coverage folks, since nobody seems to obviously own test_py3kwarn. |
|
|
msg235279 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-02-02 18:23 |
I can't reproduce the failure on Linux. |
|
|
msg249608 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2015-09-03 06:25 |
Could this have anything to do with the fact that imageop is a 'built-in' (as opposed to 'extension') module on Windows? Either way, I'm about ready to just skip testing the warning for that module on Windows. |
|
|
msg249613 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2015-09-03 07:37 |
> I can't reproduce the failure on Linux. Do you have a 64-bit system? imageop is only built on 32-bit systems... > Looks like a test ordering issue. When test_imageop runs before test_py3kwarn, the warning has presumably already been shown once and so isn't triggered when the test is looking for it (compare build 3092 linked above with 3093, which passed). Yes, I already investigated this issue and I found the same root cause. A Python module implemented in C like imageop cannot be reloaded twice. In fact, it can never be unloaded. Since the warning is emited when the module is loaded, the warning will only be emited once. The issue is not specific to imageop: test_optional_module_removals() must fail on any module implemented in C if the module was already loaded before the test is executed. > Either way, I'm about ready to just skip testing the warning for that module on Windows. The correct fix is to skip the test if the module was already loaded and if the module is implemented in C. Attached patch implements this fix. I don't know how to test if a module is implemented in C or not. I chose to check if its filename ends with ".py" (or .pyc or .pyo). |
|
|
msg249614 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2015-09-03 07:43 |
To easily test my patch, you can inject a Python 3 DeprecationWarning in the unicodedata module using attached unicodedata.patch, and then modify Lib/test/test_py3kwarn.py to add "unicodedata" to the "optional_modules" list. I tested my patch on Linux (Fedora 22, 64-bit system). |
|
|
msg249616 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2015-09-03 08:18 |
The approach LGTM. I left comments on Rietveld. |
|
|
msg249620 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2015-09-03 08:49 |
New changeset d739bc20d7b2 by Victor Stinner in branch '2.7': Issue #23375: Fix test_py3kwarn for modules implemented in C https://hg.python.org/cpython/rev/d739bc20d7b2 |
|
|
msg249621 - (view) |
Author: STINNER Victor (vstinner) *  |
Date: 2015-09-03 08:49 |
> The approach LGTM. I left comments on Rietveld. Thanks for the review. I replaced warnings.warn() with a simple print(). This issue should now be fixed. |
|
|