[Python-checkins] r61631 - python/trunk/Lib/test/test_py3kwarn.py
brett.cannon
python-checkins at python.org
Wed Mar 19 18:37:43 CET 2008
Author: brett.cannon
Date: Wed Mar 19 18:37:43 2008
New Revision: 61631
Modified:
python/trunk/Lib/test/test_py3kwarn.py
Log:
Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
Modified: python/trunk/Lib/test/test_py3kwarn.py
==============================================================================
--- python/trunk/Lib/test/test_py3kwarn.py (original)
+++ python/trunk/Lib/test/test_py3kwarn.py Wed Mar 19 18:37:43 2008
@@ -1,14 +1,12 @@
import unittest
-from test.test_support import catch_warning, TestSkipped, run_unittest
+import sys
+from test.test_support import (catch_warning, TestSkipped, run_unittest,
+ TestSkipped)
import warnings
-# TODO: This is a hack to raise TestSkipped if -3 is not enabled. Instead
-# of relying on callable to have a warning, we should expose the -3 flag
-# to Python code somehow
-with catch_warning() as w:
- callable(int)
- if w.message is None:
- raise TestSkipped('%s must be run with the -3 flag' % __name__)
+if not sys.py3kwarning:
+ raise TestSkipped('%s must be run with the -3 flag' % __name__)
+
class TestPy3KWarnings(unittest.TestCase):
More information about the Python-checkins
mailing list