Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ben Finney Newsgroups: comp.lang.python Subject: Re: Python unittest2.SkipTest and general suggestion Date: Mon, 22 Feb 2016 04:03:06 +1100 Lines: 41 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de Ng1xxcdUQiOCIeoemFrykw8LfbnPL0ZbJLP7Anb+Z97g== Cancel-Lock: sha1:Xgieq7rcTBQ7MiKaF/t1hv7tOMM= Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.035 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Python': 0.05; 'acceptance': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'exception': 0.13; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'supplying': 0.16; 'skip:{ 20': 0.18; 'version.': 0.18; 'foundation': 0.19; 'seems': 0.23; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'error': 0.27; 'skip:u 20': 0.28; 'awards': 0.29; 'subject:skip:u 10': 0.29; 'raise': 0.29; 'code': 0.30; 'maybe': 0.33; 'run': 0.33; 'except': 0.34; 'handle': 0.34; 'running': 0.34; 'text': 0.35; 'something': 0.35; 'supports': 0.35; 'community': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'display': 0.37; 'received:org': 0.37; 'suggestion': 0.37; 'mean': 0.38; 'why': 0.39; 'does': 0.39; 'to:addr:python.org': 0.40; 'software': 0.40; 'skip:u 10': 0.61; 'national': 0.63; 'different': 0.63; 'skip:\xe2 10': 0.70; 'power': 0.72; 'integrity': 0.76; '_o__)': 0.84; 'divine': 0.84; 'received:125': 0.84; 'speech,': 0.84; 'succeeds': 0.84; '\xe2\x80\x9cwe': 0.84; 'obvious,': 0.91 X-Injected-Via-Gmane: http://gmane.org/ X-Gmane-NNTP-Posting-Host: jigong.madmonks.org X-Public-Key-ID: 0xAC128405 X-Public-Key-Fingerprint: 517C F14B B2F3 98B0 CB35 4855 B8B2 4C06 AC12 8405 X-Public-Key-URL: http://www.benfinney.id.au/contact/bfinney-pubkey.asc X-Post-From: Ben Finney User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:103307 Ganesh Pal writes: > 1. unittest.SkipTest does not the display the exception message that > is caught. 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)) > 3. how do I the ensure that test_04 is run only it setUpClass succeeds > ? If setupClass fails, why would you want to continue? Handle the error inside the code for ‘setUpClass’. If that's not obvious, maybe you mean something different by “only if setUpClass succeeds”. > 3. Any other suggestion welcome Please try hard to migrate to a currently-supported Python version. The Python Software Foundation no longer supports Python 2.6, and that translates into a justifiable desire in the Python community to also stop supporting it. -- \ “We live in capitalism. Its power seems inescapable. So did the | `\ divine right of kings.” —Ursula K. LeGuin, National Book Awards | _o__) acceptance speech, 2014-11-19 | Ben Finney