On Sun, Feb 21, 2016 at 10:33 PM, Ben Finney <ben+pyt...@benfinney.id.au> wrote:
> You are already supplying a custom message to ‘self.skipTest’:: > > except Exception as exc: > logging.error(exc) > raise unittest.SkipTest("Failure running Integrity Scan ") > > So you can change that message by including the text representation of > the exception object:: > > except Exception as exc: > logging.error(exc) > raise unittest.SkipTest( > "Failure running Integrity Scan: {exc}".format(exc=exc)) > Thank you for the pointers , but I modified my code to use raise instead of exception , just wondering how will I display the message with the below code , Sample code : import os try: import unittest2 as unittest except ImportError: import unittest class MyTests(unittest.TestCase): @classmethod def setUpClass(cls): #x = False x = None if not x: raise unittest.SkipTest( "class setup failed") def test_one(self): print "test_one" def test_two(self): print "test_two" if __name__ == "__main__": unittest.main() output: gpal-3c6dc81-1# python c_4.py s ---------------------------------------------------------------------- Ran 0 tests in 0.000s OK (skipped=1) -- https://mail.python.org/mailman/listinfo/python-list