Use sys.py3kwarning instead of trying to trigger a Py3k-related warning.

This commit is contained in:
Brett Cannon 2008-03-19 17:37:43 +00:00
parent 7919d98d56
commit 977eb021f3
1 changed files with 6 additions and 8 deletions

View File

@ -1,15 +1,13 @@
import unittest 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 import warnings
# TODO: This is a hack to raise TestSkipped if -3 is not enabled. Instead if not sys.py3kwarning:
# 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__) raise TestSkipped('%s must be run with the -3 flag' % __name__)
class TestPy3KWarnings(unittest.TestCase): class TestPy3KWarnings(unittest.TestCase):
def test_type_inequality_comparisons(self): def test_type_inequality_comparisons(self):