recorder-mock allows to record interactions on patched Python objects and repeat the interactions when the patched object is no longer available.
Project description
recorder-mock
allows to record interactions on patched Python objects and repeat the interactions when the patched object is no longer available.
Installation
pip install recorder-mock
Usage
from recorder_mock import recorder_patch
@recorder_patch("httpx")
class ExampleTestCase(unittest.TestCase):
def test_get_example_com_content():
client = httpx.client()
resp = client.get("example.com")
return resp.content
First execution of the tests will hit the Internet and record the interactions. Second test run won't hit the internet, recorded interactions will be repeated instead.
Related projects
This tool was inspired by:
patch
andMagicMock
from unittest.mock standard library package- VCR.py package
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
recorder_mock-0.0.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for recorder_mock-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f519692cfa958a59ff6ed7eb59bb8c5fe462a23eaaf5cbaa3fc639cde77afa3 |
|
MD5 | 52708c5e75dda9fdf16fff37f22e3850 |
|
BLAKE2b-256 | 79496f1cb994e235bb62674b33d23a4c25ae8d81aff4d5959c076c6a05316b56 |