1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Add Path handling to use_cassette and to filesystem.py persister

* now it is possible to use path from pathlib
This commit is contained in:
Josef
2022-09-24 23:57:26 +02:00
committed by Jair Henrique
parent 511d0ab855
commit 526fdbb194
3 changed files with 28 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import inspect
import os
import types
from collections import abc as collections_abc
from pathlib import Path
import six
@@ -98,7 +99,7 @@ class VCR:
return matchers
def use_cassette(self, path=None, **kwargs):
if path is not None and not isinstance(path, str):
if path is not None and not isinstance(path, (str, Path)):
function = path
# Assume this is an attempt to decorate a function
return self._use_cassette(**kwargs)(function)