vcrpy icon indicating copy to clipboard operation
vcrpy copied to clipboard

VCR does not accept `pathlib.Path` as cassette path

Open Alexander-Serov opened this issue 3 years ago • 2 comments

>>>from pathlib import Path
>>>@vcr.use_cassette(Path('./my_path.yml'))
>>>def test():
>>>    pass
TypeError: module, class, method, function, traceback, frame, or code object was expected, got WindowsPath

Using Path is a common way of storing platoform-independent pahts. It should be easy to adapt vcrpy to using them: could just convert to str if Path.

Alexander-Serov avatar Nov 26 '21 12:11 Alexander-Serov

I would actually be fine with this behavior if vcrpy errored out as well - as it stands now, it just inexplicably doesn't write the cassette.

mhearne-usgs avatar May 22 '22 12:05 mhearne-usgs

since i wanted this functionality too i wrote this Pull requests https://github.com/kevin1024/vcrpy/pull/658 that fixes this

07pepa avatar Sep 24 '22 22:09 07pepa

This PR has been merged! Thanks for your contribution

kevin1024 avatar May 25 '23 11:05 kevin1024