kevin1024 / vcrpy

Automatically mock your HTTP interactions to simplify and speed up testing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'VCRHTTPConnection/...' has no attribute 'debuglevel'. Did you mean: 'set_debuglevel'

thomas-maschler opened this issue · comments

After updating to Python 3.12 some of my tests throw an error.
It seems that when using urlopen the connection is not correctly patched.

Below a code snippet which allows to replicate the error

from urllib.request import urlopen
import pytest

@pytest.mark.vcr
def test_vcr():
     url = "https://google.com"
     with urlopen(url) as f:
        pass
AttributeError: type object 'VCRHTTPConnection/...' has no attribute 'debuglevel'. Did you mean: 'set_debuglevel'?