msg223891 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-07-24 20:32 |
Attached is a patch that aims to clean up the ctypes tests a bit, namely by removing the custom resource management (which conflicts with regrtest), the custom test discovery (which is better left to unittest), and the custom test running (which is better covered by unittest and regrtest). The one thing I'm not entirely confident about removing is the custom refleak testing, but it does not seem to work correctly in 3.x anyway (though in 2.7, the custom refleak hunter reports "leaks" that the regrtest refleak hunter does not). There were only a few uses of the custom resource management, all of which were replaced or removed. test_SEH in test_win32 used "requires('SEH')", but that test should now be sufficiently guarded with unittest skip decorators (only trying the test on Windows, with Python built in Release configuration by MSVC). test_PyLong_Long in test_python_api used "requires('refcount')", but that should be covered by the @support.refcount_test decorator (added long after the 'requires' call). Two instances of "is_resource_enabled('printing')" were replaced by "if test.support.verbose". The same number of tests run (all successfully) on Windows, I have not yet tested on any other platforms. |
|
|
msg224956 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-06 18:21 |
Changes look simple and straightforward. LGTM. It would be good also move tests into the Lib/test/test_ctypes subdirectory and eliminate Lib/test/test_ctypes.py (may be in separate issue). And may be move initialization and verbose printinting in setUpModule() functions. |
|
|
msg224960 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-08-06 18:59 |
> Serhiy Storchaka added the comment: > It would be good also move tests into the Lib/test/test_ctypes subdirectory and eliminate Lib/test/test_ctypes.py (may be in separate issue). I plan to do so as part of #10572, if approved (or if there's no vehemently negative feedback on that issue within a couple weeks). > And may be move initialization and verbose printinting in setUpModule() functions. Fair point, I'll get a new patch up soon. |
|
|
msg225041 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-08-07 21:19 |
Here's a new patch; have I missed anything else that ought to be in setUpModule? |
|
|
msg225062 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-08 06:55 |
When the verbose variable is imported, it is impossible to control verbosity at runtime. It will be better to import only the test.support module itself and then access its attribute. |
|
|
msg225064 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-08 08:19 |
But this doesn't matter. The patch LGTM. |
|
|
msg225075 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-08-08 15:26 |
In pre-commit testing, I realized I was getting skips that I shouldn't have been getting, and it turns out that I screwed up both setUpModule functions from the previous patch. New patch fixes test_loading and test_find to use the skipTest method instead of skip decorators, so the necessary variables are actually set when they're looked for. I also combined the setUpModule in test_find with the setUp method of the TestOpenGL_libs into a setUpClass classmethod, which makes things a little simpler and cleaner. Since I was in there anyway, I went ahead and fixed your point about test.support.verbose. I had not thought about that issue previously. I'll go ahead and commit later today unless something else jumps out as being wrong. |
|
|
msg225076 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-08-08 15:35 |
Maybe this one is actually right... |
|
|
msg225080 - (view) |
Author: Serhiy Storchaka (serhiy.storchaka) *  |
Date: 2014-08-08 18:28 |
Please commit. |
|
|
msg225081 - (view) |
Author: Roundup Robot (python-dev)  |
Date: 2014-08-08 18:35 |
New changeset fc99cf3615bb by Zachary Ware in branch '3.4': Issue #22060: Clean up/simplify test_ctypes, use test discovery http://hg.python.org/cpython/rev/fc99cf3615bb New changeset 748fb6d622e8 by Zachary Ware in branch 'default': Closes #22060: Merge with 3.4 http://hg.python.org/cpython/rev/748fb6d622e8 |
|
|
msg225082 - (view) |
Author: Zachary Ware (zach.ware) *  |
Date: 2014-08-08 18:37 |
Done. Thank you for the reviews, Serhiy (and my apologies about all the spam with bad patches earlier today). |
|
|