Content-Length: 393790 | pFad | https://github.com/langchain-ai/langchain/pull/31425

88 standard-tests: migrate to pytest-recording by ccurme · Pull Request #31425 · langchain-ai/langchain · GitHub
Skip to content

standard-tests: migrate to pytest-recording #31425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 31, 2025
Merged

standard-tests: migrate to pytest-recording #31425

merged 6 commits into from
May 31, 2025

Conversation

ccurme
Copy link
Collaborator

@ccurme ccurme commented May 29, 2025

No description provided.

Copy link

vercel bot commented May 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview May 31, 2025 2:40am

Copy link

codspeed-hq bot commented May 29, 2025

CodSpeed Walltime Performance Report

Merging #31425 will not alter performance

Comparing cc/vcr (3aa729d) with master (38c19d2)

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

Summary

✅ 13 untouched benchmarks

@eyurtsev eyurtsev self-assigned this May 29, 2025
Copy link

codspeed-hq bot commented May 29, 2025

CodSpeed Instrumentation Performance Report

Merging #31425 will improve performances by 59.7%

Comparing cc/vcr (3aa729d) with master (38c19d2)

Summary

⚡ 1 improvements
✅ 12 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_stream_time 24.9 ms 15.6 ms +59.7%

eyurtsev and others added 3 commits May 30, 2025 09:16
* Create safe default serializer / deserializer.
* need to update the conftest code
Comment on lines +60 to +61
deser = serializer.deserialize(data)
return deser["requests"], deser["responses"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccurme ccurme marked this pull request as ready for review May 30, 2025 15:06
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label May 30, 2025
Copy link
Collaborator Author

@ccurme ccurme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like request / response body are loaded as bytes, not sure if that's intended / desired

Screenshot 2025-05-30 at 11 24 51 AM

@ccurme
Copy link
Collaborator Author

ccurme commented May 30, 2025

@eyurtsev FYI the new serializer is noticeably slower, I don't think it's a problem so will ignore the regressions flagged by codspeed.

@eyurtsev
Copy link
Collaborator

How is that possible??

config = _base_vcr_config.copy()
config.setdefault("filter_headers", []).extend(_EXTRA_HEADERS)
config["before_record_request"] = remove_request_headers
config["before_record_response"] = remove_response_headers
config["serializer"] = "yaml.gz"
config["path_transformer"] = VCR.ensure_suffix(".yaml.gz")

return config


@pytest.fixture
def vcr(vcr_config: dict) -> VCR:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eyurtsev blocking issue:

if we don't define the vcr fixture like this, it gets value None for some reason in langchain-tests:

cd libs/partners/anthropic
rm tests/cassettes/*
ANTHROPIC_API_KEY=... uv run python -m pytest --capture=no tests/integration_tests/test_standard.py::TestAnthropicStandard::test_stream_time

however, implementing the vcr fixture here might overwrite pytest-recording's fixture, so if you decorate a test with @pytest.mark.vcr no cassette is generated.

I suspect we should remove the vcr fixture implementation here and somehow help the test in langchain-tests pick up the fixture.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Believe this is fixed in 3aa729d

@ccurme ccurme merged commit 3db1aa0 into master May 31, 2025
117 checks passed
@ccurme ccurme deleted the cc/vcr branch May 31, 2025 19:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/langchain-ai/langchain/pull/31425

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy