TestSkipped not worth the hassle

Bug #1529143 reported by Jonathan Lange on 2015-12-24
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

stdlib unittest and unittest2 just raise SkipTest and don't have a `skipException` variable like we do. Some code (e.g. https://github.com/ClusterHQ/eliot/blob/master/eliot/testing.py#L301) hard codes checking for SkipTest as a way of telling if a test was skipped.

Is there any value in having our own special TestSkipped exception? Can we just change skipException to unittest.SkipTest?

Jonathan Lange (jml) wrote :

Looking at the code a bit more:

* we actually _do_ override our TestSkipped with SkipTest, if we can find it
* we currently prefer `unittest2.SkipTest` to `unittest.SkipTest`, which I think is wrong
* Twisted confuses this by mutating the module name of stdlib SkipTest to be `twisted.trial.unittest`


* deleting TestSkipped should wait until after we drop Python 2.6 support
* we should prefer unittest.SkipTest to unittest2.SkipTest. That is, should only use unittest2.SkipTest if the stdlib SkipTest is unavailable

Robert Collins (lifeless) wrote :

We hard depend on unittest2 these days, so we should just use unittest2.SkipTest.

If we don't use the unittest2 one, we end up with the wrong exception class, and things go badly.

I think we can delete TestSkipped now, but we should not change the preference - go through our git history and you'll see it was inverted (and buggy) in the past.

Changed in testtools:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers