summaryrefslogtreecommitdiff
path: root/src/_pytest/unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/_pytest/unittest.py')
-rw-r--r--src/_pytest/unittest.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/_pytest/unittest.py b/src/_pytest/unittest.py
index 6a90188ca..719eb4e88 100644
--- a/src/_pytest/unittest.py
+++ b/src/_pytest/unittest.py
@@ -29,7 +29,6 @@ from _pytest.python import Class
from _pytest.python import Function
from _pytest.python import PyCollector
from _pytest.runner import CallInfo
-from _pytest.skipping import skipped_by_mark_key
if TYPE_CHECKING:
import unittest
@@ -150,7 +149,7 @@ def _make_xunit_fixture(
def fixture(self, request: FixtureRequest) -> Generator[None, None, None]:
if _is_skipped(self):
reason = self.__unittest_skip_why__
- pytest.skip(reason)
+ raise pytest.skip.Exception(reason, _use_item_location=True)
if setup is not None:
try:
if pass_self:
@@ -256,9 +255,8 @@ class TestCaseFunction(Function):
def addSkip(self, testcase: "unittest.TestCase", reason: str) -> None:
try:
- skip(reason)
+ raise pytest.skip.Exception(reason, _use_item_location=True)
except skip.Exception:
- self._store[skipped_by_mark_key] = True
self._addexcinfo(sys.exc_info())
def addExpectedFailure(