mirror of
https://github.com/JockeTF/fimfarchive.git
synced 2024-11-21 21:07:59 +01:00
Fix deprecation warning in response fixture
This commit is contained in:
parent
57d53f63b1
commit
3af1632223
1 changed files with 4 additions and 3 deletions
7
tests/fixtures/responses.py
vendored
7
tests/fixtures/responses.py
vendored
|
@ -28,8 +28,8 @@ from os import environ
|
|||
from pathlib import Path
|
||||
from typing import Any, ContextManager, Dict, Iterator, Optional, Union, Type
|
||||
|
||||
import importlib_resources as resources
|
||||
import pytest
|
||||
from importlib_resources import as_file, files
|
||||
from pytest import FixtureRequest
|
||||
from requests import Session, Response
|
||||
from requests.sessions import PreparedRequest
|
||||
|
@ -178,7 +178,8 @@ def responses(request: FixtureRequest) -> Iterator[Union[Recorder, Responder]]:
|
|||
"""
|
||||
real = environ.get('REAL_HTTP', '').lower()
|
||||
name = request.path.with_suffix('.json').name
|
||||
package = request.module.__package__
|
||||
package = files(request.module.__package__)
|
||||
resource = package.joinpath(name)
|
||||
|
||||
context: Type[Union[Recorder, Responder]]
|
||||
|
||||
|
@ -187,6 +188,6 @@ def responses(request: FixtureRequest) -> Iterator[Union[Recorder, Responder]]:
|
|||
else:
|
||||
context = Responder
|
||||
|
||||
with resources.path(package, name) as path:
|
||||
with as_file(resource) as path:
|
||||
with context(path) as handler:
|
||||
yield handler
|
||||
|
|
Loading…
Reference in a new issue