From: Eli Bendersky Date: Sun, 30 Dec 2012 14:27:56 +0000 (-0800) Subject: Skip a test correctly for the C-version. The decorator doesn't really work X-Git-Tag: v3.3.1rc1~458 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=52280c427af94d53f1f8278807b2cc106b92f068;p=python 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". --- diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py index ce6bdc6d8b..2bbf513e9f 100644 --- a/Lib/test/test_xml_etree.py +++ b/Lib/test/test_xml_etree.py @@ -2420,8 +2420,11 @@ class KeywordArgsTest(unittest.TestCase): # -------------------------------------------------------------------- -@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')