Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103307

Re: Python unittest2.SkipTest and general suggestion

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ben Finney <ben+python@benfinney.id.au>
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 <mailman.15.1456074199.20994.python-list@python.org> (permalink)
References <CACT3xuUvzKN=WoE-+E2a+stOmDmmBTdp90ZOxxLydkyH2XuGhA@mail.gmail.com>
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 <python-python-list@m.gmane.org>
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 <bignose+hates-spam@benfinney.id.au>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103307

Show key headers only | View raw


Ganesh Pal <ganesh1pal@gmail.com> 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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Python unittest2.SkipTest and general suggestion Ben Finney <ben+python@benfinney.id.au> - 2016-02-22 04:03 +1100

csiph-web