[issue21829] Wrong test in ctypes
Roundup Robot added the comment: New changeset ab708e4131dd by Zachary Ware in branch '3.4': Issue #21829: Fix running test_ctypes on Windows with -O or -OO http://hg.python.org/cpython/rev/ab708e4131dd New changeset bbb28082d7b4 by Zachary Ware in branch 'default': Issue #21829: Merge with 3.4 http://hg.python.org/cpython/rev/bbb28082d7b4 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21829] Wrong test in ctypes
Zachary Ware added the comment: Thanks for the report, Claudiu. I went with a simpler fix, just comparing Py_OptimizeFlag with sys.flags.optimize. That way, we don't care if we're running as -O, -OO, or -OOO, the test will always test against the correct value. -- assignee: - zach.ware resolution: - fixed stage: patch review - resolved status: open - closed versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21829] Wrong test in ctypes
New submission from Claudiu Popa: There's a problem with ctypes.test.test_values on Windows. First, the test is wrong because it uses the following: if __debug__: self.assertEqual(opt, 0) elif ValuesTestCase.__doc__ is not None: self.assertEqual(opt, 1) ValuesTestCase doesn't have a docstring and the check always fails when running the test suite with -O or -OO. Second, running the test suite with -O and afterwards with -OO, will lead to the following failure: == FAIL: test_optimizeflag (ctypes.test.test_values.Win_ValuesTestCase) -- Traceback (most recent call last): File D:\Projects\cpython\lib\ctypes\test\test_values.py, line 50, in test_optimizeflag self.assertEqual(opt, 1) AssertionError: 2 != 1 -- That's because the .pyo file for test_values already exist when rerunning with -OO and the docstring will be there. Now, I don't know why the file is not rebuilt and the documentation regarding -OO and -O is pretty scarce. The attached file tries a different approach, regenerate a test class each time the test is run in order to obtain its docstring. If run with -OO, it will be dropped properly. -- components: Tests, ctypes files: ctypes.patch keywords: patch messages: 221351 nosy: Claudiu.Popa priority: normal severity: normal stage: patch review status: open title: Wrong test in ctypes type: behavior versions: Python 3.5 Added file: http://bugs.python.org/file35738/ctypes.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21829] Wrong test in ctypes
Changes by Claudiu Popa pcmantic...@gmail.com: -- nosy: +zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21829] Wrong test in ctypes
R. David Murray added the comment: There is an issue open for the -O/-OO and .pyo file issue. Or maybe we closed it won't fix, I forget. -O/-OO have problems. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21829 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com