jeudi 21 mai 2015

Make xmlrunner python package to avoid throwing skip Atrribute error on python 2.6

am in serious trouble, I have python 2.6 I have unittest module and xmlrunner, I want xml output no matter what from this test, if I use xmlrunner, it throws skip Atrribute error, but skip does not work < 2.7 version... Any great suggestions ?

import unittest
import xmlrunner

class Topology(unittest.TestCase):

    @unittest.skip("demonstrating skipping")
    def test_skipped(self):
        self.fail("shouldn't happen")

    def test_pass(self):
        self.assertEqual(10, 7 + 3)

    def test_fail(self):
        self.assertEqual(11, 7 + 3)    


if __name__ == '__main__':
    unittest.main(testRunner=xmlrunner.XMLTestRunner(output='test-reports'))

Error:
Traceback (most recent call last):
  File "./test.py", line 4, in <module>
    class Topology(unittest.TestCase):
  File "./test.py", line 6, in Topology
    @unittest.skip("demonstrating skipping")
AttributeError: 'module' object has no attribute 'skip'

Aucun commentaire:

Enregistrer un commentaire