diff --git a/swh/core/db/pytest_plugin.py b/swh/core/db/pytest_plugin.py --- a/swh/core/db/pytest_plugin.py +++ b/swh/core/db/pytest_plugin.py @@ -8,6 +8,7 @@ import subprocess from typing import Optional, Set, Union +from _pytest.fixtures import FixtureRequest import psycopg2 import pytest from pytest_postgresql import factories @@ -137,7 +138,7 @@ no_truncate_tables: Set[str] = {"dbversion"}, ): @pytest.fixture - def postgresql_factory(request): + def postgresql_factory(request: FixtureRequest): """Fixture factory for PostgreSQL. :param FixtureRequest request: fixture request object diff --git a/swh/core/pytest_plugin.py b/swh/core/pytest_plugin.py --- a/swh/core/pytest_plugin.py +++ b/swh/core/pytest_plugin.py @@ -10,6 +10,7 @@ from typing import Dict, List, Optional from urllib.parse import unquote, urlparse +from _pytest.fixtures import FixtureRequest import pytest import requests from requests.adapters import BaseAdapter @@ -117,7 +118,7 @@ @pytest.fixture -def datadir(request): +def datadir(request: FixtureRequest) -> str: """By default, returns the test directory's data directory. This can be overridden on a per file tree basis. Add an override @@ -297,7 +298,7 @@ # stolen from pytest-flask, required to have url_for() working within tests # using flask_app_client fixture. @pytest.fixture(autouse=True) -def _push_request_context(request): +def _push_request_context(request: FixtureRequest): """During tests execution request context has been pushed, e.g. `url_for`, `session`, etc. can be used in tests as is:: diff --git a/swh/core/tests/test_config.py b/swh/core/tests/test_config.py --- a/swh/core/tests/test_config.py +++ b/swh/core/tests/test_config.py @@ -16,7 +16,7 @@ if pytest_v < pkg_resources.extern.packaging.version.parse("3.9"): @pytest.fixture - def tmp_path(request): + def tmp_path(): import pathlib import tempfile