From db5e12bf4197c80dd0aaf63bf878c69ff20f1997 Mon Sep 17 00:00:00 2001 From: "brett.cannon" Date: Wed, 19 Mar 2008 17:37:43 +0000 Subject: [PATCH] Use sys.py3kwarning instead of trying to trigger a Py3k-related warning. git-svn-id: http://svn.python.org/projects/python/trunk@61631 6015fed2-1504-0410-9fe1-9d1591cc4771 --- Lib/test/test_py3kwarn.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_py3kwarn.py b/Lib/test/test_py3kwarn.py index cc1e9f4d50..cb450ff14b 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): -- 2.11.4.GIT