summaryrefslogtreecommitdiff
path: root/src/_pytest/doctest.py
diff options
context:
space:
mode:
authorpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>2020-12-30 11:56:09 +0200
committerGitHub <noreply@github.com>2020-12-30 11:56:09 +0200
commitee03e31831900c3a7aba9f94a9693a833a3ab9de (patch)
tree431d7984ce45526a5403316fddafac12171cd25c /src/_pytest/doctest.py
parent77519048753f629847d3edaf8344753ad6689ada (diff)
downloadpytest-ee03e31831900c3a7aba9f94a9693a833a3ab9de.tar.gz
[pre-commit.ci] pre-commit autoupdate (#8201)
* [pre-commit.ci] pre-commit autoupdate * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * manual fixes after configuration update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Anthony Sottile <asottile@umich.edu>
Diffstat (limited to 'src/_pytest/doctest.py')
-rw-r--r--src/_pytest/doctest.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/_pytest/doctest.py b/src/_pytest/doctest.py
index 24f888257..255ca80b9 100644
--- a/src/_pytest/doctest.py
+++ b/src/_pytest/doctest.py
@@ -121,7 +121,9 @@ def pytest_unconfigure() -> None:
def pytest_collect_file(
- fspath: Path, path: py.path.local, parent: Collector,
+ fspath: Path,
+ path: py.path.local,
+ parent: Collector,
) -> Optional[Union["DoctestModule", "DoctestTextfile"]]:
config = parent.config
if fspath.suffix == ".py":
@@ -193,7 +195,11 @@ def _init_runner_class() -> Type["doctest.DocTestRunner"]:
self.continue_on_failure = continue_on_failure
def report_failure(
- self, out, test: "doctest.DocTest", example: "doctest.Example", got: str,
+ self,
+ out,
+ test: "doctest.DocTest",
+ example: "doctest.Example",
+ got: str,
) -> None:
failure = doctest.DocTestFailure(test, example, got)
if self.continue_on_failure:
@@ -303,13 +309,14 @@ class DoctestItem(pytest.Item):
# TODO: Type ignored -- breaks Liskov Substitution.
def repr_failure( # type: ignore[override]
- self, excinfo: ExceptionInfo[BaseException],
+ self,
+ excinfo: ExceptionInfo[BaseException],
) -> Union[str, TerminalRepr]:
import doctest
failures: Optional[
Sequence[Union[doctest.DocTestFailure, doctest.UnexpectedException]]
- ] = (None)
+ ] = None
if isinstance(
excinfo.value, (doctest.DocTestFailure, doctest.UnexpectedException)
):
@@ -510,7 +517,9 @@ class DoctestModule(pytest.Module):
obj = getattr(obj, "fget", obj)
# Type ignored because this is a private function.
return doctest.DocTestFinder._find_lineno( # type: ignore
- self, obj, source_lines,
+ self,
+ obj,
+ source_lines,
)
def _find(