summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2008-03-19 17:37:43 (GMT)
committerBrett Cannon <bcannon@gmail.com>2008-03-19 17:37:43 (GMT)
commit977eb021f318fcb6558aa22fcf3131e72e2ad319 (patch)
treec5224bb39eb1b64706f9b710c75f987b9ade91d6 /Lib/test
parent7919d98d566c7c1491636e69d61b816358023914 (diff)
downloadcpython-977eb021f318fcb6558aa22fcf3131e72e2ad319.zip
cpython-977eb021f318fcb6558aa22fcf3131e72e2ad319.tar.gz
cpython-977eb021f318fcb6558aa22fcf3131e72e2ad319.tar.bz2
Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_py3kwarn.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py
index cc1e9f4..cb450ff 100644
--- a/Lib/test/test_py3kwarn.py
+++ b/Lib/test/test_py3kwarn.py
@@ -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):