Skip to content
Snippets Groups Projects
Commit 7be2dbf0 authored by Antoine Lambert's avatar Antoine Lambert
Browse files

requirements-test: Remove pytest pinning to < 7

pytest-postgresql 3.1.3 and pytest-redis 2.4.0 added support for
pytest >= 7 so we can now drop the pytest pinning.
parent 2a261535
No related branches found
No related tags found
No related merge requests found
hypothesis >= 3.11.0
pytest < 7.0.0 # v7.0.0 removed _pytest.tmpdir.TempdirFactory, which is used by some of the pytest plugins we use
pytest
pytest-mock
pytz
requests-mock
......@@ -9,4 +9,3 @@ types-psycopg2
types-pytz
types-pyyaml
types-requests
......@@ -11,7 +11,6 @@ import re
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
......@@ -119,7 +118,7 @@ def get_response_cb(
@pytest.fixture
def datadir(request: FixtureRequest) -> str:
def datadir(request: pytest.FixtureRequest) -> str:
"""By default, returns the test directory's data directory.
This can be overridden on a per file tree basis. Add an override
......@@ -135,7 +134,9 @@ def datadir(request: FixtureRequest) -> str:
"""
return path.join(path.dirname(str(request.fspath)), "data")
# pytest >= 7 renamed FixtureRequest fspath attribute to path
path_ = request.path if hasattr(request, "path") else request.fspath # type: ignore
return path.join(path.dirname(str(path_)), "data")
def requests_mock_datadir_factory(
......@@ -310,7 +311,7 @@ def flask_app_client(app):
# 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: FixtureRequest):
def _push_request_context(request: pytest.FixtureRequest):
"""During tests execution request context has been pushed, e.g. `url_for`,
`session`, etc. can be used in tests as is::
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment