Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testsuite fails with urllib3 >= 2.0.0 due to vcrpy incompatibility #535

Open
glaubitz opened this issue May 16, 2023 · 7 comments
Open

Testsuite fails with urllib3 >= 2.0.0 due to vcrpy incompatibility #535

glaubitz opened this issue May 16, 2023 · 7 comments
Labels
SDK Issue pertains to the SDK itself and not specific to any service

Comments

@glaubitz
Copy link

When the system's version of urlib3 is 2.0.0 or higher, the testsuite of oci-python-sdk fails due an incompatibility of vcrpy with urlib3 >= 2.0.0:

[  458s] + pytest-3.9 --ignore=_build.python39 --ignore=_build.python311 --ignore=_build.python310 -v tests/unit tests/integ -s
[  459s] ImportError while loading conftest '/home/abuild/rpmbuild/BUILD/oci-python-sdk-2.96.0/tests/conftest.py'.
[  460s] tests/conftest.py:9: in <module>
[  460s]     from tests.integ import util
[  460s] tests/integ/util.py:13: in <module>
[  460s]     from .. import test_config_container
[  460s] tests/test_config_container.py:13: in <module>
[  460s]     import vcr
[  460s] /usr/lib/python3.9/site-packages/vcr/__init__.py:2: in <module>
[  460s]     from .config import VCR
[  460s] /usr/lib/python3.9/site-packages/vcr/config.py:11: in <module>
[  460s]     from .cassette import Cassette
[  460s] /usr/lib/python3.9/site-packages/vcr/cassette.py:12: in <module>
[  460s]     from .patch import CassettePatcherBuilder
[  460s] /usr/lib/python3.9/site-packages/vcr/patch.py:41: in <module>
[  460s]     _VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
[  460s] E   AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'
[  460s] error: Bad exit status from /var/tmp/rpm-tmp.x8HlyJ (%check)

[1] kevin1024/vcrpy#688

@KartikShrikantHegde
Copy link

Hi @glaubitz , is there a specific python-sdk version in which you are seeing this error? if so can you let us know which version it is? Also, can you confirm which platform are you running this on? Thanks.

@KartikShrikantHegde KartikShrikantHegde added the SDK Issue pertains to the SDK itself and not specific to any service label May 31, 2023
@dandelion12345
Copy link

Same issue

@TechNickAI
Copy link

A potential clue - My code works on python 3.10+, but fails on python 3.9 with:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.9.17/x64/bin/pytest", line 8, in <module>
    sys.exit(console_main())
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 189, in console_main
    code = main()
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 147, in main
    config = _prepareconfig(args, plugins)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 328, in _prepareconfig
    config = pluginmanager.hook.pytest_cmdline_parse(
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_hooks.py", line 433, in __call__
    return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_manager.py", line 112, in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_callers.py", line [13](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:14)3, in _multicall
    teardown[0].send(outcome)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/helpconfig.py", line 103, in pytest_cmdline_parse
    config: Config = outcome.get_result()
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_result.py", line 108, in get_result
    raise exc.with_traceback(exc.__traceback__)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_callers.py", line 80, in _multicall
    res = hook_impl.function(*args)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1075, in pytest_cmdline_parse
    self.parse(args)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line [14](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:15)25, in parse
    self._preparse(args, addopts=addopts)
  File "/opt/hostedtoolcache/Python/3.9.[17](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:18)/x64/lib/python3.9/site-packages/_pytest/config/__init__.py", line 1305, in _preparse
    self.pluginmanager.load_setuptools_entrypoints("pytest11")
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pluggy/_manager.py", line 364, in load_setuptools_entrypoints
    plugin = ep.load()
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/importlib/metadata.py", line 86, in load
    module = import_module(match.group('module'))
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/importlib/__init__.py", line 1[27](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:28), in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 10[30](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:31), in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/_pytest/assertion/rewrite.py", line 178, in exec_module
    exec(co, module.__dict__)
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/pytest_recording/plugin.py", line 9, in <module>
    from vcr.cassette import Cassette
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/__init__.py", line 4, in <module>
    from .config import VCR
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/config.py", line 12, in <module>
    from .cassette import Cassette
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/cassette.py", line 13, in <module>
    from .patch import CassettePatcherBuilder
  File "/opt/hostedtoolcache/Python/3.9.17/x64/lib/python3.9/site-packages/vcr/patch.py", line [41](https://github.com/gorillamania/AICodeBot/actions/runs/5846720056/job/15852212987#step:6:42), in <module>
    _VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'
Error: Process completed with exit code 1.

@atmosmps
Copy link

atmosmps commented Aug 16, 2023

I have this exactly same issue when i run my code with fastapi==0.95.2 and python3.9

/usr/local/lib/python3.9/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1030: in _gcd_import
    ???
<frozen importlib._bootstrap>:1007: in _find_and_load
    ???
<frozen importlib._bootstrap>:986: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:680: in _load_unlocked
    ???
../.local/lib/python3.9/site-packages/_pytest/assertion/rewrite.py:170: in exec_module
    exec(co, module.__dict__)
src/tests/conftest.py:7: in <module>
    import vcr
../.local/lib/python3.9/site-packages/vcr/__init__.py:2: in <module>
    from .config import VCR
../.local/lib/python3.9/site-packages/vcr/config.py:11: in <module>
    from .cassette import Cassette
../.local/lib/python3.9/site-packages/vcr/cassette.py:12: in <module>
    from .patch import CassettePatcherBuilder
../.local/lib/python3.9/site-packages/vcr/patch.py:41: in <module>
    _VerifiedHTTPSConnection = cpool.VerifiedHTTPSConnection
E   AttributeError: module 'urllib3.connectionpool' has no attribute 'VerifiedHTTPSConnection'

The versions of my dependencies are:

fastapi==0.95.2
uvicorn==0.15.0
gunicorn==20.1.0
requests==2.31.0
python-dotenv==0.19.0
simplejson==3.17.5
motor==2.5.1
aiohttp==3.8.4

pytest==6.2.5
pytest-xdist==2.4.0
pytest-cov==2.12.1
diff-cover==6.4.0
flake8==3.9.2
black==22.3.0
Faker==8.14.1
pytest-asyncio==0.15.1
vcrpy==4.1.1
testfixtures==6.18.3
freezegun==0.3.4
aioresponses==0.7.2
mypy==0.961
isort==5.10.1
httpx==0.24.1

@bhagwatvyas
Copy link
Member

I am looking into this issue. As @glaubitz pointed out this is coming from vcrpy kevin1024/vcrpy#688. Are you able to get around this issue by manually pinning urllib3<2 if you don't need to use the specific version of urllib3>=2?

@bhagwatvyas
Copy link
Member

@gorillamania @atmosmps I'm curious if you are using the oci package? If not, this is an issue with vcrpy and you might find helpful answers on the issue I've mentioned above

@atmosmps
Copy link

@bhagwatvyas thank you for your reply. I'm not actually using this oci package, I just came into this similar problem. I solved my problem another way by rollback a version of my dependency that uses urllib3. At the moment I'm doing it like this. But thanks for the reference, I'll take a look to see if you can help me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SDK Issue pertains to the SDK itself and not specific to any service
Projects
None yet
Development

No branches or pull requests

6 participants