Kaydet (Commit) 977eb021 authored tarafından Brett Cannon's avatar Brett Cannon

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

üst 7919d98d
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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment