summaryrefslogtreecommitdiff
path: root/tests/mixins.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-11 15:25:11 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-03-11 15:25:11 -0500
commit1bdcc691f5127edf9f197f8b509a2eeff51edcd6 (patch)
tree60fdc179154ae813e53abc0493b9b01eb9e933ab /tests/mixins.py
parentd2985974a0fba46df7552a9958c7f9ef34f75868 (diff)
downloadpython-coveragepy-git-1bdcc691f5127edf9f197f8b509a2eeff51edcd6.tar.gz
test: simplify how StopEverything is converted to skipnedbat/remove-unittest-testcase
The auto-decorating metaclass was interfering with parameterized methods on Python 2.7. But we don't need it anymore anyway, since pytest will let us hook to deal with the exception in a simpler way.
Diffstat (limited to 'tests/mixins.py')
-rw-r--r--tests/mixins.py28
1 files changed, 0 insertions, 28 deletions
diff --git a/tests/mixins.py b/tests/mixins.py
index 4954a6a5..e8068be4 100644
--- a/tests/mixins.py
+++ b/tests/mixins.py
@@ -7,17 +7,14 @@ Test class mixins
Some of these are transitional while working toward pure-pytest style.
"""
-import functools
import os
import os.path
import sys
-import types
import textwrap
import pytest
from coverage import env
-from coverage.misc import StopEverything
class PytestBase(object):
@@ -146,31 +143,6 @@ class TempDirMixin(object):
return filename
-def convert_skip_exceptions(method):
- """A decorator for test methods to convert StopEverything to skips."""
- @functools.wraps(method)
- def _wrapper(*args, **kwargs):
- try:
- result = method(*args, **kwargs)
- except StopEverything:
- pytest.skip("StopEverything!")
- return result
- return _wrapper
-
-
-class SkipConvertingMetaclass(type):
- """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):
- attrs[attr_name] = convert_skip_exceptions(attr_value)
-
- return super(SkipConvertingMetaclass, cls).__new__(cls, name, bases, attrs)
-
-
-StopEverythingMixin = SkipConvertingMetaclass('StopEverythingMixin', (), {})
-
-
class StdStreamCapturingMixin:
"""
Adapter from the pytest capsys fixture to more convenient methods.