Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support vcrpy v5 #110

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Changelog
-------------

- Drop support for Python 3.5 and 3.6. `#97`_
- Support `vcrpy v5 <https://github.com/kevin1024/vcrpy/releases/tag/v5.0.0>`_. `#110`_

`0.12.2`_ - 2023-02-16
----------------------
Expand Down Expand Up @@ -208,6 +209,7 @@ Added
.. _0.3.0: https://github.com/kiwicom/pytest-recording/compare/v0.2.0...v0.3.0
.. _0.2.0: https://github.com/kiwicom/pytest-recording/compare/v0.1.0...v0.2.0

.. _#110: https://github.com/kiwicom/pytest-recording/pull/110
.. _#99: https://github.com/kiwicom/pytest-recording/pull/99
.. _#97: https://github.com/kiwicom/pytest-recording/issues/97
.. _#82: https://github.com/kiwicom/pytest-recording/pull/82
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from setuptools import find_packages, setup

install_requires = ["vcrpy>=2.0.1,<5", "pytest>=3.5.0", "attrs"]
install_requires = ["vcrpy>=2.0.1", "pytest>=3.5.0", "attrs"]


def read(fname):
Expand Down
3 changes: 2 additions & 1 deletion src/pytest_recording/_vcr.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from vcr.persisters.filesystem import FilesystemPersister
from vcr.serialize import deserialize

from .exceptions import CassetteNotFoundError
from .utils import unique, unpack

ConfigType = Dict[str, Any]
Expand Down Expand Up @@ -49,7 +50,7 @@ def load_cassette( # pylint: disable=arguments-differ
requests, responses = starmap(unpack, zip(*all_content))
requests, responses = list(requests), list(responses)
if not requests or not responses:
raise ValueError("No cassettes found.")
raise CassetteNotFoundError("No cassettes found.")
return requests, responses


Expand Down
12 changes: 12 additions & 0 deletions src/pytest_recording/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
try:
from vcr.cassette import CassetteNotFoundError
except ImportError:
# Required until vcrpy minimum version is v5.0.0, avoid type checking to
# skip no-redef
class CassetteNotFoundError(ValueError): # type: ignore
pass


class UsageError(Exception):
"""Error in plugin usage."""

__module__ = "builtins"


__all__ = ["UsageError", "CassetteNotFoundError"]