kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing
MIT License
2.72k stars 388 forks source link

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

Closed Alexander-Serov closed 1 year ago

Alexander-Serov commented 3 years ago
>>>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.

mhearne-usgs commented 2 years ago

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.

07pepa commented 2 years ago

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

kevin1024 commented 1 year ago

This PR has been merged! Thanks for your contribution