kiwicom / pytest-recording

A pytest plugin that allows recording network interactions via VCR.py
MIT License
425 stars 34 forks source link

No cassettes found on vcrpy==5.0.0 release. Works with 4.* #111

Closed Alexander-Serov closed 1 year ago

Alexander-Serov commented 1 year ago

Describe the bug vcrpy==5.0 has been released and pytest-recording does not work with it anymore. A vcrpy maintainer has indicated that this is related to that VCR.py 5.0.0 is no longer expecting and catching ValueError but a new exception CassetteNotFoundError. And pytest-recording seems to not limit the version of vcr.py to the current major version, so it broke on upstream upgrade.

To Reproduce Launch any test with vcrpy==5.0 on cassettes created with vcrpy==4.*. See here for an example of the output. The main message is

>           raise ValueError("No cassettes found.")
E           ValueError: No cassettes found.
venv/lib/python3.8/site-packages/pytest_recording/_vcr.py:48: ValueError

Expected behavior

Environment (please complete the following information):

does not seem to be pertinent, but

Additional context Cc @hartwork

Stranger6667 commented 1 year ago

Hi!

Thanks for opening an issue! A WIP PR is here

hartwork commented 1 year ago

@Alexander-Serov thanks for the report!

Expected behavior

  • correctly interact with vcrpy==5.0

  • intercept the new exception

I think you meant raising CassetteDecodeError or CassetteNotFoundErrorinstead.

  • suggestion: in future, limit compatibility to a major upstream version only vcrpy~=5.0 and perform major updates manually.

I would like to vote for just vcrpy>=5.0 (or no limit) and leave the rest to the and user / consuming application. Bumping VCR.py from 4.x.x to 5.0.0 is a major version bump in semver so the user has full responsibility in my view.

Alexander-Serov commented 1 year ago

@hartwork agreed on bumping to a major version, and pytest-recording is the user in this case. But to avoid accidents like this one, when the pipeline becomes blocked, I would vote for setting vcrpy>=5.0,<6 in this repo, with the update to 6 done manually. This would give time to the maintainers of this repo to implement changes and test without people like me coming and opening issues. And the end user does not specify a version of vcrpy since it's an internal dep of pytest-recording for us. Just my 2 cents.

@Stranger6667 Thanks for already working on it!

Stranger6667 commented 1 year ago

I guess the props for working on the issue should go to @gadomski :)

At this point, instead of failing in runtime, it would be better to note that pytest-recording is compatible only with vcrpy<4.4.0 (there is 1 failing test)

mezhaka commented 1 year ago

Hi folks, I see the PR https://github.com/kiwicom/pytest-recording/pull/110 has been suspended for now. Is there any plan or intention in this direction?

Stranger6667 commented 1 year ago

hi @mezhaka !

Yes, I'd like to add support for vcrpy==5.0.0, but I don't have the bandwidth at the moment. Meantime, PRs (including those adding partial support) are welcome

hartwork commented 1 year ago

@Stranger6667 thanks for partial, I'll give it another shot right now…

hartwork commented 1 year ago

Pull request #118 now ready for a first round of review.

Stranger6667 commented 1 year ago

Thank you @hartwork !

I'll release a new version this week! :) Hopefully, I could also take a look at the tests that are failing on VCRPy 5.0

Stranger6667 commented 1 year ago

The new version is released! :tada: Thank you for your patience