summaryrefslogtreecommitdiff
path: root/tests/test_testing.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-03-08 19:19:49 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-03-11 06:38:43 -0500
commit7cf60e32077ae480ebd9b435c6c0dc3c0042b30f (patch)
treedfb8f238496963895c3c4eaf1fb586c00540eccf /tests/test_testing.py
parentb69daacebf81149e87642324e13ad068853cea93 (diff)
downloadpython-coveragepy-git-7cf60e32077ae480ebd9b435c6c0dc3c0042b30f.tar.gz
refactor: use pytest.skip instead of unittest's
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r--tests/test_testing.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py
index 1e30fa2f..e3053e96 100644
--- a/tests/test_testing.py
+++ b/tests/test_testing.py
@@ -8,7 +8,6 @@ import datetime
import os
import re
import sys
-import unittest
import pytest
@@ -317,6 +316,13 @@ def test_re_line_bad(text, pat):
def test_convert_skip_exceptions():
+ # pytest doesn't expose the exception raised by pytest.skip, so let's
+ # make one to get the class.
+ try:
+ pytest.skip("Just to get the exception")
+ except BaseException as exc:
+ pytest_Skipped = type(exc)
+
@convert_skip_exceptions
def some_method(ret=None, exc=None):
"""Be like a test case."""
@@ -331,8 +337,8 @@ def test_convert_skip_exceptions():
with pytest.raises(ValueError):
some_method(exc=ValueError)
- # But a StopEverything becomes a SkipTest.
- with pytest.raises(unittest.SkipTest):
+ # But a StopEverything becomes a skip.
+ with pytest.raises(pytest_Skipped):
some_method(exc=StopEverything)