Merge pull request #6744 from bluetech/item-runtest-stub

Add Item.runtest stub implementation
This commit is contained in:
Ran Benita 2020-02-15 23:27:57 +02:00 committed by GitHub
commit 0c68e7a2c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

View File

@ -239,7 +239,7 @@ class DoctestItem(pytest.Item):
globs[name] = value
self.dtest.globs.update(globs)
def runtest(self):
def runtest(self) -> None:
_check_all_skipped(self.dtest)
self._disable_output_capturing_for_darwin()
failures = [] # type: List[doctest.DocTestFailure]

View File

@ -521,6 +521,9 @@ class Item(Node):
#: defined properties for this test.
self.user_properties = [] # type: List[Tuple[str, Any]]
def runtest(self) -> None:
raise NotImplementedError("runtest must be implemented by Item subclass")
def add_report_section(self, when: str, key: str, content: str) -> None:
"""
Adds a new report section, similar to what's done internally to add stdout and

View File

@ -1474,7 +1474,7 @@ class Function(PyobjMixin, nodes.Item):
warnings.warn(FUNCARGNAMES, stacklevel=2)
return self.fixturenames
def runtest(self):
def runtest(self) -> None:
""" execute the underlying test function. """
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
@ -1519,7 +1519,7 @@ class FunctionDefinition(Function):
crappy metafunc hack
"""
def runtest(self):
def runtest(self) -> None:
raise RuntimeError("function definitions are not supposed to be used")
setup = runtest