Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
A pytest plugin powered by VCR.py to record and replay HTTP traffic.
| Date | Stars |
|---|---|
| 2026-07-24 | 614 |
| 2026-07-25 | 614 |
| 2026-07-28 | 614 |
| 2026-07-30 | 614 |
| 2026-08-06 | 614 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
pytest-recording
================
|codecov| |Build| |Version| |Python versions| |License|
A pytest plugin powered by VCR.py to record and replay HTTP traffic.
Features
--------
- Straightforward ``pytest.mark.vcr``, that reflects ``VCR.use_cassettes`` API;
- Combining multiple VCR cassettes;
- Network access blocking;
- The ``rewrite`` recording mode that rewrites cassettes from scratch.
Installation
------------
This project can be installed via pip:
.. code:: bash
pip install pytest-recording
⚠️ Incompatibility Warning
If you have ``pytest-vcr`` installed, please uninstall it before using ``pytest-recording``, as the two plugins are incompatible.
Usage
-----
.. code:: python
import pytest
import requests
# cassettes/{module_name}/test_single.yaml will be used
@pytest.mark.vcr
def test_single():
assert requests.get("http://httpbin.org/get").text == '{"get": true}'
# cassettes/{module_name}/example.yaml will be used
@pytest.mark.default_cassette("example.yaml")
@pytest.mark.vcr
def test_default():
assert requests.get("http://httpbin.org/get").text == '{"get": true}'
# these cassettes will be used in addition to the default one
@pytest.mark.vcr("/path/to/ip.yaml", "/path/to/get.yaml")
def test_multiple():
assert requests.get("http://httpbin.org/get").text == '{"get": true}'
assert requests.get("http://httpbin.org/ip").text == '{"ip": true}'
# Make assertions based on the cassette calls/responses:
@pytest.mark.vcr
def test_call_count(vcr):
assert requests.get("http://httpbin.org/get").text == '{"get": true}'
assert requests.get("http://httpbin.org/ip").text == '{"ip": true}'
# See https://vcrpy.readthedocs.io/en/latest/advanced.html for more info
# about the Cassette object:
assert vcr.play_count == 2
Run your tests:
.. code:: bash
pytest --record-mode=once test_network.py
Default recording mode
~~~~~~~~~~~~~~~~~~~~~~
``pytest-recording`` uses the ``none`` VCR recording mode by default to prevent unintentional network requests.
To allow them you need to pass a different recording mode (e.g. ``once``) via the ``--record-mode`` CLI option to your test command.
See more information about available recording modes in the `official VCR documentation <https://vcrpy.readthedocs.io/en/latest/usage.html#record-modes>`_
Configuration
~~~~~~~~~~~~~
You can provide the recording configuration with the ``vcr_config`` fixture, which could be any scope - ``session``,
``package``, ``module``, or ``function``. It should return a dictionary that will be passed directly to ``VCR.use_cassettes``
under the hood.
.. code:: python
import pytest
@pytest.fixture(scope="module")
def vcr_config():
return {"filter_headers": ["authorization"]}
For more granular control you need to pass these keyword arguments to individual ``pytest.mark.vcr`` marks, and in this case
all arguments will be merged into a single dictionary with the following priority (low -> high):
- ``vcr_config`` fixture
- all marks from the most broad scope ("session") to the most narrow one ("function")
Example:
.. code:: python
import pytest
pytestmark = [pytest.mark.vcr(ignore_localhost=True)]
@pytest.fixture(scope="module")
def vcr_config():
return {"filter_headers": ["authorization"]}
@pytest.mark.vcr(filter_headers=[])
def test_one():
...
@pytest.mark.vcr(filter_query_parameters=["api_key"])
def test_two():
...
Resulting VCR configs for each test:
- ``test_one`` - ``{"ignore_localhost": True, "filter_headers": []}``
- ``test_two`` - ``{"ignore_localhost": True, "filter_headers": ["authorization"], "filter_query_parameters": ["api_key"]}``
The ``vcr_config`` fixture forwards any keyword argument to vcrpy, so ``ignore_hosts``
and other VCR.py options work directly:
.. code:: python
import pytest
@pytest.fixture(scope="moduleExcerpt of 9,533 characters
Read on GitHubDmitry Dygalo · Workato · Czech Republic
124
32
John Litborn · Denmark
8
Sebastian Pipping · Germany
4
3
2
Hugo van Kemenade · Finland
1
1
Mohamed Amine Zghal · Tunisia
1
Ang · Malaysia
1
1
1
1
1
1
1
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:7b095c8831375333, topic:testing