From 115dd19a76966f13f185468861214f08d19bce64 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 1 Dec 2021 17:59:57 -0300 Subject: [PATCH] Rename pytest_report_collectionfinish startpath parameter to start_path --- src/_pytest/config/compat.py | 2 +- src/_pytest/hookspec.py | 6 +++--- src/_pytest/terminal.py | 2 +- testing/test_terminal.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_pytest/config/compat.py b/src/_pytest/config/compat.py index 67d1b9ec5..8f82dd9f9 100644 --- a/src/_pytest/config/compat.py +++ b/src/_pytest/config/compat.py @@ -14,7 +14,7 @@ imply_paths_hooks = { "pytest_collect_file": ("file_path", "path"), "pytest_pycollect_makemodule": ("module_path", "path"), "pytest_report_header": ("start_path", "startdir"), - "pytest_report_collectionfinish": ("startpath", "startdir"), + "pytest_report_collectionfinish": ("start_path", "startdir"), } diff --git a/src/_pytest/hookspec.py b/src/_pytest/hookspec.py index 09e2afd15..b65be9815 100644 --- a/src/_pytest/hookspec.py +++ b/src/_pytest/hookspec.py @@ -704,7 +704,7 @@ def pytest_report_header( def pytest_report_collectionfinish( config: "Config", - startpath: Path, + start_path: Path, startdir: "LEGACY_PATH", items: Sequence["Item"], ) -> Union[str, List[str]]: @@ -716,7 +716,7 @@ def pytest_report_collectionfinish( .. versionadded:: 3.2 :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 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 `. .. 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 has been deprecated. """ diff --git a/src/_pytest/terminal.py b/src/_pytest/terminal.py index 990e8a400..ccbd84d7d 100644 --- a/src/_pytest/terminal.py +++ b/src/_pytest/terminal.py @@ -738,7 +738,7 @@ class TerminalReporter: lines = self.config.hook.pytest_report_collectionfinish( config=self.config, - startpath=self.startpath, + start_path=self.startpath, items=session.items, ) self._write_report_lines_from_hooks(lines) diff --git a/testing/test_terminal.py b/testing/test_terminal.py index c1f0921fd..23f597e33 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -1035,7 +1035,7 @@ class TestTerminalFunctional: def test_report_collectionfinish_hook(self, pytester: Pytester, params) -> None: 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'] """ )