Skip to content

Commit

Permalink
pre-commit again
Browse files Browse the repository at this point in the history
  • Loading branch information
RonnyPfannschmidt committed Oct 27, 2019
1 parent aec6cb6 commit dd515e0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion changelog/5975.deprecation.rst
Expand Up @@ -3,4 +3,4 @@ Deprecate using direct constructors for ``Nodes``.
Instead they are new constructed via ``Node.from_parent``.

This painful transitional mechanism enables us to detangle the very intensely
entangled ``Node`` relationships.
entangled ``Node`` relationships.
9 changes: 6 additions & 3 deletions src/_pytest/deprecated.py
Expand Up @@ -8,7 +8,8 @@
All constants defined in this module should be either PytestWarning instances or UnformattedWarning
in case of warnings which need to format their messages.
"""
from _pytest.warning_types import PytestDeprecationWarning, UnformattedWarning
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import UnformattedWarning

# set of plugins which have been integrated into the core; we use this list to ignore
# them during registration to avoid conflicts
Expand All @@ -35,5 +36,7 @@
"as a keyword argument instead."
)

NODE_USE_FROM_PARENT = UnformattedWarning(PytestDeprecationWarning,
"direct construction of {name} has been deprecated, please use {name}.from_parent",)
NODE_USE_FROM_PARENT = UnformattedWarning(
PytestDeprecationWarning,
"direct construction of {name} has been deprecated, please use {name}.from_parent",
)
8 changes: 6 additions & 2 deletions src/_pytest/doctest.py
Expand Up @@ -336,7 +336,9 @@ def collect(self):
parser = doctest.DocTestParser()
test = parser.get_doctest(text, globs, name, filename, 0)
if test.examples:
yield DoctestItem.from_parent(self, name=test.name, runner=runner, dtest=test)
yield DoctestItem.from_parent(
self, name=test.name, runner=runner, dtest=test
)


def _check_all_skipped(test):
Expand Down Expand Up @@ -432,7 +434,9 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):

for test in finder.find(module, module.__name__):
if test.examples: # skip empty doctests
yield DoctestItem.from_parent(self, name=test.name, runner=runner, dtest=test)
yield DoctestItem.from_parent(
self, name=test.name, runner=runner, dtest=test
)


def _setup_fixtures(doctest_item):
Expand Down
8 changes: 2 additions & 6 deletions src/_pytest/nodes.py
Expand Up @@ -2,7 +2,6 @@
import warnings
from contextlib import contextmanager
from functools import lru_cache
from functools import wraps
from typing import Any
from typing import Dict
from typing import List
Expand All @@ -14,11 +13,11 @@

import _pytest._code
from _pytest.compat import getfslineno
from _pytest.deprecated import NODE_USE_FROM_PARENT
from _pytest.mark.structures import Mark
from _pytest.mark.structures import MarkDecorator
from _pytest.mark.structures import NodeKeywords
from _pytest.outcomes import fail
from _pytest.deprecated import NODE_USE_FROM_PARENT

if False: # TYPE_CHECKING
# Imported here due to circular import.
Expand Down Expand Up @@ -72,10 +71,7 @@ class NodeMeta(type):

def __call__(self, *k, **kw):
if not self.__in_named_ctor:
warnings.warn(
NODE_USE_FROM_PARENT.format(name=self.__name__),
stacklevel=3,
)
warnings.warn(NODE_USE_FROM_PARENT.format(name=self.__name__), stacklevel=3)
return self._create(*k, **kw)

@contextmanager
Expand Down

0 comments on commit dd515e0

Please sign in to comment.