Skip to content

Commit 622e6cf

Browse files
author
gabino
committed
Fix VCRHTTPResponse version_string AttributeError in tests
1 parent 19c5838 commit 622e6cf

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,20 @@
99

1010
cuenca.configure(sandbox=True)
1111

12+
# Temporary patch for the VCRHTTPResponse object to avoid
13+
# AttributeError: 'VCRHTTPResponse' object has no attribute 'version_string'
14+
# Occurs with urllib3>=2.3.0 and is being addressed in the following PR:
15+
# https://github.com/kevin1024/vcrpy/pull/889
16+
17+
18+
@pytest.fixture(autouse=True)
19+
def patch_VCRHTTPResponse_version_string():
20+
from vcr.stubs import VCRHTTPResponse # type: ignore
21+
22+
if not hasattr(VCRHTTPResponse, 'version_string'):
23+
VCRHTTPResponse.version_string = None
24+
yield
25+
1226

1327
@pytest.fixture(scope='module')
1428
def vcr_config():

0 commit comments

Comments
 (0)