Metadata-Version: 2.1
Name: pytest-vcrpandas
Version: 0.0.1
Summary: Test from HTTP interactions to dataframe processed.
Home-page: https://github.com/gjeusel/pytest-vcrpandas
Author: See AUTHORS
Author-email: "guillaume.jeusel@gmail.com"
License: UNKNOWN
Platform: UNKNOWN
Classifier: Framework :: Pytest
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Requires-Dist: vcrpy
Requires-Dist: pandas
Requires-Dist: pytest

.. image:: https://travis-ci.com/gjeusel/pytest-vcrpandas.svg?branch=master
  :target: https://travis-ci.com/gjeusel/pytest-vcrpandas
.. image:: https://readthedocs.org/projects/pytest-vcrpandas/badge/?version=latest
  :target: http://pytest-vcrpandas.readthedocs.io/en/latest/?badge=latest
  :alt: Documentation Status
.. image:: https://codecov.io/gh/gjeusel/pytest-vcrpandas/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/gjeusel/pytest-vcrpandas
.. image:: https://badge.fury.io/py/pytest-vcrpandas.svg
  :target: https://pypi.python.org/pypi/pytest-vcrpandas/
  :alt: Pypi package

===============================
pytest-vcrpandas
===============================

Combine `vcrpy <https://github.com/kevin1024/vcrpy>`_ with
`pandas <https://github.com/pandas-dev/pandas>`_ to not only mock your HTTP interactions,
but also tests your post-processing work to get a pandas DataFrame.

Usage
-----

.. code:: python

    # 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)


.. code:: bash

    # 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
------------

.. code:: bash

    pip install pytest-vcrpandas



