pytest-vcr-1.0.2/ 0000775 0001750 0001750 00000000000 13460652756 014132 5 ustar tomek tomek 0000000 0000000 pytest-vcr-1.0.2/pytest_vcr.egg-info/ 0000775 0001750 0001750 00000000000 13460652756 020026 5 ustar tomek tomek 0000000 0000000 pytest-vcr-1.0.2/pytest_vcr.egg-info/top_level.txt 0000664 0001750 0001750 00000000013 13460652756 022552 0 ustar tomek tomek 0000000 0000000 pytest_vcr
pytest-vcr-1.0.2/pytest_vcr.egg-info/requires.txt 0000664 0001750 0001750 00000000024 13460652756 022422 0 ustar tomek tomek 0000000 0000000 pytest>=3.6.0
vcrpy
pytest-vcr-1.0.2/pytest_vcr.egg-info/dependency_links.txt 0000664 0001750 0001750 00000000001 13460652756 024074 0 ustar tomek tomek 0000000 0000000
pytest-vcr-1.0.2/pytest_vcr.egg-info/entry_points.txt 0000664 0001750 0001750 00000000035 13460652756 023322 0 ustar tomek tomek 0000000 0000000 [pytest11]
vcr = pytest_vcr
pytest-vcr-1.0.2/pytest_vcr.egg-info/SOURCES.txt 0000664 0001750 0001750 00000000415 13460652756 021712 0 ustar tomek tomek 0000000 0000000 LICENSE
MANIFEST.in
README.rst
pytest_vcr.py
setup.cfg
setup.py
pytest_vcr.egg-info/PKG-INFO
pytest_vcr.egg-info/SOURCES.txt
pytest_vcr.egg-info/dependency_links.txt
pytest_vcr.egg-info/entry_points.txt
pytest_vcr.egg-info/requires.txt
pytest_vcr.egg-info/top_level.txt pytest-vcr-1.0.2/pytest_vcr.egg-info/PKG-INFO 0000664 0001750 0001750 00000005406 13460652756 021130 0 ustar tomek tomek 0000000 0000000 Metadata-Version: 1.2
Name: pytest-vcr
Version: 1.0.2
Summary: Plugin for managing VCR.py cassettes
Home-page: https://github.com/ktosiek/pytest-vcr
Author: Tomasz Kontusz
Author-email: tomasz.kontusz@gmail.com
Maintainer: Tomasz Kontusz
Maintainer-email: tomasz.kontusz@gmail.com
License: MIT
Description: ##########
pytest-vcr
##########
|Travis| |AppVeyor| |ReadTheDocs|
.. |Travis| image:: https://travis-ci.org/ktosiek/pytest-vcr.svg?branch=master
:target: https://travis-ci.org/ktosiek/pytest-vcr
:alt: See Build Status on Travis CI
.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/ktosiek/pytest-vcr?branch=master
:target: https://ci.appveyor.com/project/ktosiek/pytest-vcr/branch/master
:alt: See Build Status on AppVeyor
.. |ReadTheDocs| image:: https://readthedocs.org/projects/pytest-vcr/badge/?version=latest
:target: http://pytest-vcr.readthedocs.io/en/latest/?badge=latest
:alt: See the documentation
Py.test plugin for managing `VCR.py `_ cassettes.
Quick Start
===========
Install the plugin:
.. code-block:: sh
pip install pytest-vcr
Annotate your tests:
.. code-block:: python
@pytest.mark.vcr()
def test_iana():
response = urlopen('http://www.iana.org/domains/reserved').read()
assert b'Example domains' in response
And that's it!
A new file ``cassettes/test_iana.yaml`` will be created next to your test file on the first run.
This file should be committed to a VCS.
For more examples and configuration options see the `documention on ReadTheDocs `_.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
pytest-vcr-1.0.2/README.rst 0000664 0001750 0001750 00000002463 13372276324 015621 0 ustar tomek tomek 0000000 0000000 ##########
pytest-vcr
##########
|Travis| |AppVeyor| |ReadTheDocs|
.. |Travis| image:: https://travis-ci.org/ktosiek/pytest-vcr.svg?branch=master
:target: https://travis-ci.org/ktosiek/pytest-vcr
:alt: See Build Status on Travis CI
.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/ktosiek/pytest-vcr?branch=master
:target: https://ci.appveyor.com/project/ktosiek/pytest-vcr/branch/master
:alt: See Build Status on AppVeyor
.. |ReadTheDocs| image:: https://readthedocs.org/projects/pytest-vcr/badge/?version=latest
:target: http://pytest-vcr.readthedocs.io/en/latest/?badge=latest
:alt: See the documentation
Py.test plugin for managing `VCR.py `_ cassettes.
Quick Start
===========
Install the plugin:
.. code-block:: sh
pip install pytest-vcr
Annotate your tests:
.. code-block:: python
@pytest.mark.vcr()
def test_iana():
response = urlopen('http://www.iana.org/domains/reserved').read()
assert b'Example domains' in response
And that's it!
A new file ``cassettes/test_iana.yaml`` will be created next to your test file on the first run.
This file should be committed to a VCS.
For more examples and configuration options see the `documention on ReadTheDocs `_.
pytest-vcr-1.0.2/setup.cfg 0000664 0001750 0001750 00000000103 13460652756 015745 0 ustar tomek tomek 0000000 0000000 [bdist_wheel]
universal = 1
[egg_info]
tag_build =
tag_date = 0
pytest-vcr-1.0.2/LICENSE 0000664 0001750 0001750 00000002072 13372276324 015133 0 ustar tomek tomek 0000000 0000000
The MIT License (MIT)
Copyright (c) 2017 Tomasz Kontusz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
pytest-vcr-1.0.2/MANIFEST.in 0000664 0001750 0001750 00000000141 13372276324 015657 0 ustar tomek tomek 0000000 0000000 include LICENSE
include README.rst
recursive-exclude * __pycache__
recursive-exclude * *.py[co]
pytest-vcr-1.0.2/pytest_vcr.py 0000664 0001750 0001750 00000006107 13460651221 016674 0 ustar tomek tomek 0000000 0000000 # -*- coding: utf-8 -*-
import os
import warnings
import pytest
from vcr import VCR
def pytest_addoption(parser):
group = parser.getgroup('vcr')
group.addoption(
'--vcr-record',
action='store',
dest='vcr_record',
default=None,
choices=['once', 'new_episodes', 'none', 'all'],
help='Set the recording mode for VCR.py.'
)
# TODO: deprecated, remove in a future release
group.addoption(
'--vcr-record-mode',
action='store',
dest='deprecated_vcr_record',
default=None,
choices=['once', 'new_episodes', 'none', 'all'],
help='DEPRECATED: use --vcr-record'
)
group.addoption(
'--disable-vcr',
action='store_true',
dest='disable_vcr',
help='Run tests without playing back from VCR.py cassettes'
)
def pytest_load_initial_conftests(early_config, parser, args):
early_config.addinivalue_line(
'markers',
'vcr: Mark the test as using VCR.py.')
@pytest.fixture(autouse=True)
def _vcr_marker(request):
marker = request.node.get_closest_marker('vcr')
if marker:
request.getfixturevalue('vcr_cassette')
def _update_kwargs(request, kwargs):
marker = request.node.get_closest_marker('vcr')
if marker:
kwargs.update(marker.kwargs)
record_mode = request.config.getoption('--vcr-record-mode')
record_mode = request.config.getoption('--vcr-record') or record_mode
if record_mode:
kwargs['record_mode'] = record_mode
if request.config.getoption('--disable-vcr'):
# Set mode to record but discard all responses to disable both recording and playback
kwargs['record_mode'] = 'new_episodes'
kwargs['before_record_response'] = lambda *args, **kwargs: None
@pytest.fixture(scope='module')
def vcr(request, vcr_config, vcr_cassette_dir, ):
"""The VCR instance"""
if request.config.getoption('--vcr-record-mode'):
warnings.warn("--vcr-record-mode has been deprecated and will be removed in a future "
"release. Use --vcr-record instead.",
DeprecationWarning)
kwargs = dict(
cassette_library_dir=vcr_cassette_dir,
path_transformer=VCR.ensure_suffix(".yaml"),
)
kwargs.update(vcr_config)
_update_kwargs(request, kwargs)
vcr = VCR(**kwargs)
return vcr
@pytest.fixture
def vcr_cassette(request, vcr, vcr_cassette_name):
"""Wrap a test in a VCR.py cassette"""
kwargs = {}
_update_kwargs(request, kwargs)
with vcr.use_cassette(vcr_cassette_name, **kwargs) as cassette:
yield cassette
@pytest.fixture(scope='module')
def vcr_cassette_dir(request):
test_dir = request.node.fspath.dirname
return os.path.join(test_dir, 'cassettes')
@pytest.fixture
def vcr_cassette_name(request):
"""Name of the VCR cassette"""
test_class = request.cls
if test_class:
return "{}.{}".format(test_class.__name__, request.node.name)
return request.node.name
@pytest.fixture(scope='module')
def vcr_config():
"""Custom configuration for VCR.py"""
return {}
pytest-vcr-1.0.2/setup.py 0000664 0001750 0001750 00000003112 13460652114 015625 0 ustar tomek tomek 0000000 0000000 #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import codecs
from setuptools import setup
def read(fname):
file_path = os.path.join(os.path.dirname(__file__), fname)
return codecs.open(file_path, encoding='utf-8').read()
setup(
name='pytest-vcr',
version='1.0.2',
author='Tomasz Kontusz',
author_email='tomasz.kontusz@gmail.com',
maintainer='Tomasz Kontusz',
maintainer_email='tomasz.kontusz@gmail.com',
license='MIT',
url='https://github.com/ktosiek/pytest-vcr',
description='Plugin for managing VCR.py cassettes',
long_description=read('README.rst'),
py_modules=['pytest_vcr'],
install_requires=['pytest>=3.6.0', 'vcrpy'],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Pytest',
'Intended Audience :: Developers',
'Topic :: Software Development :: Testing',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
],
entry_points={
'pytest11': [
'vcr = pytest_vcr',
],
},
)
pytest-vcr-1.0.2/PKG-INFO 0000664 0001750 0001750 00000005406 13460652756 015234 0 ustar tomek tomek 0000000 0000000 Metadata-Version: 1.2
Name: pytest-vcr
Version: 1.0.2
Summary: Plugin for managing VCR.py cassettes
Home-page: https://github.com/ktosiek/pytest-vcr
Author: Tomasz Kontusz
Author-email: tomasz.kontusz@gmail.com
Maintainer: Tomasz Kontusz
Maintainer-email: tomasz.kontusz@gmail.com
License: MIT
Description: ##########
pytest-vcr
##########
|Travis| |AppVeyor| |ReadTheDocs|
.. |Travis| image:: https://travis-ci.org/ktosiek/pytest-vcr.svg?branch=master
:target: https://travis-ci.org/ktosiek/pytest-vcr
:alt: See Build Status on Travis CI
.. |AppVeyor| image:: https://ci.appveyor.com/api/projects/status/github/ktosiek/pytest-vcr?branch=master
:target: https://ci.appveyor.com/project/ktosiek/pytest-vcr/branch/master
:alt: See Build Status on AppVeyor
.. |ReadTheDocs| image:: https://readthedocs.org/projects/pytest-vcr/badge/?version=latest
:target: http://pytest-vcr.readthedocs.io/en/latest/?badge=latest
:alt: See the documentation
Py.test plugin for managing `VCR.py `_ cassettes.
Quick Start
===========
Install the plugin:
.. code-block:: sh
pip install pytest-vcr
Annotate your tests:
.. code-block:: python
@pytest.mark.vcr()
def test_iana():
response = urlopen('http://www.iana.org/domains/reserved').read()
assert b'Example domains' in response
And that's it!
A new file ``cassettes/test_iana.yaml`` will be created next to your test file on the first run.
This file should be committed to a VCS.
For more examples and configuration options see the `documention on ReadTheDocs `_.
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Testing
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License