Test from HTTP interactions to dataframe processed.
Project description
pytest-vcrpandas
Combine vcrpy with pandas to not only mock your HTTP interactions, but also tests your post-processing work to get a pandas DataFrame.
Usage
# test_meteo_client.py
def test_meteo_get_wind_speed(vcrpandas, client):
start = pd.Timestamp('2018-01-01', tz='CET')
end = pd.Timestamp('2018-02-01', tz='CET')
with vcrpandas("meteo_get_wind_speed") as recorder:
df = client.get_wind_speed(start, end)
recorder(df)
# call pytest for the first time to generate samples
> pytest --vcr-record="new_episodes"
# you can now replay it:
> pytest
Behind the hood, 2 files are generated by the first run:
a meteo_get_wind_speed.yaml, which is the reponse obtained by the first HTTP interaction.
a meteo_get_wind_speed.pickle that serve to compare the formatting from the mocked response to the pandas DataFrame, types included.
Installation
pip install pytest-vcrpandas
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_vcrpandas-0.0.1-py2.py3-none-any.whl.
File metadata
- Download URL: pytest_vcrpandas-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.0 CPython/3.6.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e69ddd32375d34534977ec39a2c2d8e789ea9a22061469f3e3fe0830377a6269
|
|
| MD5 |
1c708e80c176b23fcd554be18e6069db
|
|
| BLAKE2b-256 |
441e165b4db92df50b8c51aeb676fac554268fab0f5a7cdc60f09db4c6f4d768
|