diff options
author | John Szakmeister <john@szakmeister.net> | 2014-01-09 01:50:20 -0800 |
---|---|---|
committer | John Szakmeister <john@szakmeister.net> | 2014-01-09 01:50:20 -0800 |
commit | d6fb99868d8ad3fd9cb965591da50577f73173fc (patch) | |
tree | 305f48da2fe55586658906a7ff55e5b4883b0cbe /nose | |
parent | 1536b4cc0ad18d0465273b19b43f77bf4ab17db1 (diff) | |
parent | 395a1bff9919f083eba9eb45800692e8ab55728c (diff) | |
download | nose-d6fb99868d8ad3fd9cb965591da50577f73173fc.tar.gz |
Merge pull request #699 from ianw/skiptest-exception
Look for unittest2 in skip plugin
Diffstat (limited to 'nose')
-rw-r--r-- | nose/plugins/skip.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/nose/plugins/skip.py b/nose/plugins/skip.py index 27e5162..9d1ac8f 100644 --- a/nose/plugins/skip.py +++ b/nose/plugins/skip.py @@ -9,15 +9,22 @@ is enabled by default but may be disabled with the ``--no-skip`` option. from nose.plugins.errorclass import ErrorClass, ErrorClassPlugin +# on SkipTest: +# - unittest SkipTest is first preference, but it's only available +# for >= 2.7 +# - unittest2 SkipTest is second preference for older pythons. This +# mirrors logic for choosing SkipTest exception in testtools +# - if none of the above, provide custom class try: - # 2.7 from unittest.case import SkipTest except ImportError: - # 2.6 and below - class SkipTest(Exception): - """Raise this exception to mark a test as skipped. - """ - pass + try: + from unittest2.case import SkipTest + except ImportError: + class SkipTest(Exception): + """Raise this exception to mark a test as skipped. + """ + pass class Skip(ErrorClassPlugin): |