Rename pytest_report_collectionfinish startpath parameter to start_path

This commit is contained in:
Bruno Oliveira 2021-12-01 17:59:57 -03:00
parent f72efb6ed8
commit 115dd19a76
4 changed files with 6 additions and 6 deletions

View File

@ -14,7 +14,7 @@ imply_paths_hooks = {
"pytest_collect_file": ("file_path", "path"), "pytest_collect_file": ("file_path", "path"),
"pytest_pycollect_makemodule": ("module_path", "path"), "pytest_pycollect_makemodule": ("module_path", "path"),
"pytest_report_header": ("start_path", "startdir"), "pytest_report_header": ("start_path", "startdir"),
"pytest_report_collectionfinish": ("startpath", "startdir"), "pytest_report_collectionfinish": ("start_path", "startdir"),
} }

View File

@ -704,7 +704,7 @@ def pytest_report_header(
def pytest_report_collectionfinish( def pytest_report_collectionfinish(
config: "Config", config: "Config",
startpath: Path, start_path: Path,
startdir: "LEGACY_PATH", startdir: "LEGACY_PATH",
items: Sequence["Item"], items: Sequence["Item"],
) -> Union[str, List[str]]: ) -> Union[str, List[str]]:
@ -716,7 +716,7 @@ def pytest_report_collectionfinish(
.. versionadded:: 3.2 .. versionadded:: 3.2
:param pytest.Config config: The pytest config object. :param pytest.Config config: The pytest config object.
:param Path startpath: The starting dir. :param Path start_path: The starting dir.
:param LEGACY_PATH startdir: The starting dir (deprecated). :param LEGACY_PATH startdir: The starting dir (deprecated).
:param items: List of pytest items that are going to be executed; this list should not be modified. :param items: List of pytest items that are going to be executed; this list should not be modified.
@ -728,7 +728,7 @@ def pytest_report_collectionfinish(
:ref:`trylast=True <plugin-hookorder>`. :ref:`trylast=True <plugin-hookorder>`.
.. versionchanged:: 7.0.0 .. versionchanged:: 7.0.0
The ``startpath`` parameter was added as a :class:`pathlib.Path` The ``start_path`` parameter was added as a :class:`pathlib.Path`
equivalent of the ``startdir`` parameter. The ``startdir`` parameter equivalent of the ``startdir`` parameter. The ``startdir`` parameter
has been deprecated. has been deprecated.
""" """

View File

@ -738,7 +738,7 @@ class TerminalReporter:
lines = self.config.hook.pytest_report_collectionfinish( lines = self.config.hook.pytest_report_collectionfinish(
config=self.config, config=self.config,
startpath=self.startpath, start_path=self.startpath,
items=session.items, items=session.items,
) )
self._write_report_lines_from_hooks(lines) self._write_report_lines_from_hooks(lines)

View File

@ -1035,7 +1035,7 @@ class TestTerminalFunctional:
def test_report_collectionfinish_hook(self, pytester: Pytester, params) -> None: def test_report_collectionfinish_hook(self, pytester: Pytester, params) -> None:
pytester.makeconftest( pytester.makeconftest(
""" """
def pytest_report_collectionfinish(config, startpath, items): def pytest_report_collectionfinish(config, start_path, items):
return [f'hello from hook: {len(items)} items'] return [f'hello from hook: {len(items)} items']
""" """
) )