diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-03-08 19:19:49 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-03-11 06:38:43 -0500 |
commit | 7cf60e32077ae480ebd9b435c6c0dc3c0042b30f (patch) | |
tree | dfb8f238496963895c3c4eaf1fb586c00540eccf /tests/mixins.py | |
parent | b69daacebf81149e87642324e13ad068853cea93 (diff) | |
download | python-coveragepy-git-7cf60e32077ae480ebd9b435c6c0dc3c0042b30f.tar.gz |
refactor: use pytest.skip instead of unittest's
Diffstat (limited to 'tests/mixins.py')
-rw-r--r-- | tests/mixins.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tests/mixins.py b/tests/mixins.py index 8fe0690b..4954a6a5 100644 --- a/tests/mixins.py +++ b/tests/mixins.py @@ -13,7 +13,6 @@ import os.path import sys import types import textwrap -import unittest import pytest @@ -148,19 +147,19 @@ class TempDirMixin(object): def convert_skip_exceptions(method): - """A decorator for test methods to convert StopEverything to SkipTest.""" + """A decorator for test methods to convert StopEverything to skips.""" @functools.wraps(method) def _wrapper(*args, **kwargs): try: result = method(*args, **kwargs) except StopEverything: - raise unittest.SkipTest("StopEverything!") + pytest.skip("StopEverything!") return result return _wrapper class SkipConvertingMetaclass(type): - """Decorate all test methods to convert StopEverything to SkipTest.""" + """Decorate all test methods to convert StopEverything to skips.""" def __new__(cls, name, bases, attrs): for attr_name, attr_value in attrs.items(): if attr_name.startswith('test_') and isinstance(attr_value, types.FunctionType): |