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


Groups > comp.lang.python > #103307 > unrolled thread

Re: Python unittest2.SkipTest and general suggestion

Started byBen Finney <ben+python@benfinney.id.au>
First post2016-02-22 04:03 +1100
Last post2016-02-22 04:03 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#103307 — Re: Python unittest2.SkipTest and general suggestion

FromBen Finney <ben+python@benfinney.id.au>
Date2016-02-22 04:03 +1100
SubjectRe: Python unittest2.SkipTest and general suggestion
Message-ID<mailman.15.1456074199.20994.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web