doctest: Fix circular import with pytest.skip

This commit is contained in:
Tony Narlock 2022-09-24 09:40:53 -05:00
parent 51d4215373
commit a7091f9e13
1 changed files with 3 additions and 3 deletions

View File

@ -23,7 +23,6 @@ from typing import Type
from typing import TYPE_CHECKING
from typing import Union
import pytest
from _pytest import outcomes
from _pytest._code.code import ExceptionInfo
from _pytest._code.code import ReprFileLocation
@ -37,6 +36,7 @@ from _pytest.fixtures import FixtureRequest
from _pytest.nodes import Collector
from _pytest.nodes import Item
from _pytest.outcomes import OutcomeException
from _pytest.outcomes import skip
from _pytest.pathlib import fnmatch_ex
from _pytest.pathlib import import_path
from _pytest.python import Module
@ -452,7 +452,7 @@ def _check_all_skipped(test: "doctest.DocTest") -> None:
all_skipped = all(x.options.get(doctest.SKIP, False) for x in test.examples)
if all_skipped:
pytest.skip("all tests skipped by +SKIP option")
skip("all tests skipped by +SKIP option")
def _is_mocked(obj: object) -> bool:
@ -552,7 +552,7 @@ class DoctestModule(Module):
)
except ImportError:
if self.config.getvalue("doctest_ignore_import_errors"):
pytest.skip("unable to import module %r" % self.path)
skip("unable to import module %r" % self.path)
else:
raise
# Uses internal doctest module parsing mechanism.