使用 VCR.py 为确定性 Python 测试记录和重放 HTTP 固件
Use VCR.py when an agent needs to turn flaky, slow, or rate-limited Python tests into stable runs by recording real HTTP interactions once and replaying them from cassette files. The agent decides which requests belong in fixtures, refreshes stale cassettes when upstream APIs change, and keeps external traffic out of the repeat test loop.
Prerequisites
Python plus VCR.py integrated into the project's test framework
Installation
Requirements and caveats from upstream:
- |PyPI| |Python versions| |Build Status| |CodeCov| |Gitter|
- This is a Python version of Ruby's VCR
- :target: https://pypi.python.org/pypi/vcrpy
Basic usage or getting-started notes:
- first time you run code that is inside a VCR.py context manager or
- recognizes from the original test run and return the responses that
- to do is delete your existing cassette files, and run your tests again.
- Source: https://github.com/1991513ccie-png/skills
- Extracted from upstream docs: https://raw.githubusercontent.com/kevin1024/vcrpy/HEAD/README.rst
Documentation
- https://vcrpy.readthedocs.io/