Skip to content

Commit b8b45b7

Browse files
toualeStranger6667
touale
authored andcommitted
fix: Use fallback for max filename length on Windows
1 parent 8a7e19f commit b8b45b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pytest_recording/_vcr.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@
2121

2222
from .utils import ConfigType, merge_kwargs, unique, unpack
2323

24-
MAX_FILENAME_LEN = os.pathconf(".", "PC_NAME_MAX")
24+
try:
25+
# Try to get max filename length on Unix-like systems
26+
MAX_FILENAME_LEN = os.pathconf(".", "PC_NAME_MAX")
27+
except (AttributeError, ValueError, OSError):
28+
# Fallback for Windows or unsupported systems
29+
MAX_FILENAME_LEN = 255
2530

2631

2732
def load_cassette(cassette_path: str, serializer: ModuleType) -> Tuple[List, List]:

0 commit comments

Comments
 (0)