mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-17 16:39:52 +00:00
add conftests
This commit is contained in:
parent
f504062687
commit
bd4a96dc50
24
libs/partners/openai/tests/conftest.py
Normal file
24
libs/partners/openai/tests/conftest.py
Normal file
@ -0,0 +1,24 @@
|
||||
import pytest
|
||||
from langchain_tests.conftest import _base_vcr_config
|
||||
|
||||
_EXTRA_HEADERS = [
|
||||
("openai-organization", "PLACEHOLDER"),
|
||||
("x-openai-client-user-agent", "PLACEHOLDER"),
|
||||
]
|
||||
|
||||
|
||||
def remove_response_headers(response):
|
||||
response["headers"] = {}
|
||||
return response
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def vcr_config(_base_vcr_config: dict) -> dict:
|
||||
"""
|
||||
Extend the default configuration coming from langchain_tests.
|
||||
"""
|
||||
config = _base_vcr_config.copy()
|
||||
config.setdefault("filter_headers", []).extend(_EXTRA_HEADERS)
|
||||
config["before_record_response"] = remove_response_headers
|
||||
|
||||
return config
|
25
libs/standard-tests/langchain_tests/conftest.py
Normal file
25
libs/standard-tests/langchain_tests/conftest.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pytest
|
||||
|
||||
_BASE_FILTER_HEADERS = [
|
||||
("authorization", "PLACEHOLDER"),
|
||||
("x-api-key", "PLACEHOLDER"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def _base_vcr_config() -> dict:
|
||||
"""
|
||||
Configuration that every cassette will receive.
|
||||
(Anything permitted by vcr.VCR(**kwargs) can be put here.)
|
||||
"""
|
||||
return {
|
||||
"record_mode": "once",
|
||||
"filter_headers": _BASE_FILTER_HEADERS.copy(),
|
||||
"match_on": ["method", "scheme", "host", "port", "path", "query"],
|
||||
"decode_compressed_response": True,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def vcr_config(_base_vcr_config: dict) -> dict:
|
||||
return _base_vcr_config
|
Loading…
Reference in New Issue
Block a user