[Python-checkins] cpython (3.3): Skip a test correctly for the C-version. The decorator doesn't really work

eli.bendersky python-checkins at python.org
Sun Dec 30 15:30:02 CET 2012


http://hg.python.org/cpython/rev/e2cce1100bd3
changeset:   81153:e2cce1100bd3
branch:      3.3
parent:      81151:71508fc738bb
user:        Eli Bendersky <eliben at gmail.com>
date:        Sun Dec 30 06:27:56 2012 -0800
summary:
  Skip a test correctly for the C-version. The decorator doesn't really work
because it evaluates its condition before pyET is even set by test_main.
Therefore, the check it moved to "runtime".

files:
  Lib/test/test_xml_etree.py |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -2420,8 +2420,11 @@
 
 # --------------------------------------------------------------------
 
- at unittest.skipUnless(pyET, 'only for the Python version')
 class NoAcceleratorTest(unittest.TestCase):
+    def setUp(self):
+        if not pyET:
+            raise SkipTest('only for the Python version')
+
     # Test that the C accelerator was not imported for pyET
     def test_correct_import_pyET(self):
         self.assertEqual(pyET.Element.__module__, 'xml.etree.ElementTree')

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list