diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2014-06-26 20:20:44 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2014-06-26 20:20:44 (GMT) |
commit | 7180c793c4a4da364260b848ac92f7841561d26a (patch) | |
tree | 9aa242b66921325fea80b19fb9148acb4cefe909 /Lib/ctypes | |
parent | c6772c4d592be2274a66ccd26b5956738fc6e4f8 (diff) | |
download | cpython-7180c793c4a4da364260b848ac92f7841561d26a.zip cpython-7180c793c4a4da364260b848ac92f7841561d26a.tar.gz cpython-7180c793c4a4da364260b848ac92f7841561d26a.tar.bz2 |
Issue #21829: Fix running test_ctypes on Windows with -O or -OO
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/test_values.py | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/Lib/ctypes/test/test_values.py b/Lib/ctypes/test/test_values.py index ae9f562..1c1fd7d 100644 --- a/Lib/ctypes/test/test_values.py +++ b/Lib/ctypes/test/test_values.py @@ -33,20 +33,11 @@ class Win_ValuesTestCase(unittest.TestCase): """This test only works when python itself is a dll/shared library""" def test_optimizeflag(self): - # This test accesses the Py_OptimizeFlag intger, which is - # exported by the Python dll. + # This test accesses the Py_OptimizeFlag integer, which is + # exported by the Python dll and should match the sys.flags value - # It's value is set depending on the -O and -OO flags: - # if not given, it is 0 and __debug__ is 1. - # If -O is given, the flag is 1, for -OO it is 2. - # docstrings are also removed in the latter case. opt = c_int.in_dll(pythonapi, "Py_OptimizeFlag").value - if __debug__: - self.assertEqual(opt, 0) - elif ValuesTestCase.__doc__ is not None: - self.assertEqual(opt, 1) - else: - self.assertEqual(opt, 2) + self.assertEqual(opt, sys.flags.optimize) def test_frozentable(self): # Python exports a PyImport_FrozenModules symbol. This is a |