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

Fix for newer requests-cache #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

berarma
Copy link

@berarma berarma commented Jun 29, 2023

These changes fix errors with newer requests-cache. Tested against requests-cache 0.9.8, the version in Debian 12.

Fixes dbr/tvnamer#210 (comment)

@georghuber
Copy link

Cheers! Thanks. Will this be automatically distributed in the FreeBSD ports tree (sorry, kind of a noob here when it comes to ports/updating/maintaining)=

Georg

@berarma
Copy link
Author

berarma commented Jul 1, 2023

Cheers! Thanks. Will this be automatically distributed in the FreeBSD ports tree (sorry, kind of a noob here when it comes to ports/updating/maintaining)=

Georg

I don't know if or when this PR might be merged. You can send a link to this to the package maintainer.

@georghuber
Copy link

I don't know if or when this PR might be merged. You can send a link to this to the package maintainer.

Thats exactly what I did, many thanks again!

@sandrotosi
Copy link

Im not sure this patch is enough to establish compat with more recent versions of requests_cache; f.e. attempting at running the test suit i get:

I: pybuild base:240: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build
collected 0 items / 1 error

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_tvdb_api.py ____________________
/usr/lib/python3/dist-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3/dist-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3/dist-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3/dist-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3/dist-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3/dist-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3/dist-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3/dist-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_tvdb_api.py:106: in <module>
    requests_cache.backends.registry['tvdb_api_file_cache'] = FileCache
E   AttributeError: module 'requests_cache.backends' has no attribute 'registry'
=========================== short test summary info ============================
ERROR tests/test_tvdb_api.py - AttributeError: module 'requests_cache.backend...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.23s ===============================
E: pybuild pybuild:388: test: plugin distutils failed with: exit code=2: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests

could you have a look at this too please? ideally try running the tests, as they may uncover more issues -- thanks!

@berarma
Copy link
Author

berarma commented Aug 2, 2023

Im not sure this patch is enough to establish compat with more recent versions of requests_cache; f.e. attempting at running the test suit i get:

I: pybuild base:240: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build
collected 0 items / 1 error

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_tvdb_api.py ____________________
/usr/lib/python3/dist-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3/dist-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3/dist-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3/dist-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3/dist-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3/dist-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3/dist-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3/dist-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_tvdb_api.py:106: in <module>
    requests_cache.backends.registry['tvdb_api_file_cache'] = FileCache
E   AttributeError: module 'requests_cache.backends' has no attribute 'registry'
=========================== short test summary info ============================
ERROR tests/test_tvdb_api.py - AttributeError: module 'requests_cache.backend...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.23s ===============================
E: pybuild pybuild:388: test: plugin distutils failed with: exit code=2: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests

could you have a look at this too please? ideally try running the tests, as they may uncover more issues -- thanks!

I think this is fixed now. The error seemed to be only in the test code. It was using internals of requests-cache that have changed.

@georghuber
Copy link

Im not sure this patch is enough to establish compat with more recent versions of requests_cache; f.e. attempting at running the test suit i get:

I: pybuild base:240: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.4, pytest-7.4.0, pluggy-1.2.0
rootdir: /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build
collected 0 items / 1 error

==================================== ERRORS ====================================
___________________ ERROR collecting tests/test_tvdb_api.py ____________________
/usr/lib/python3/dist-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3/dist-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3/dist-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3/dist-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3/dist-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3/dist-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/usr/lib/python3/dist-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3/dist-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib/python3.11/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1204: in _gcd_import
    ???
<frozen importlib._bootstrap>:1176: in _find_and_load
    ???
<frozen importlib._bootstrap>:1147: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:690: in _load_unlocked
    ???
/usr/lib/python3/dist-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_tvdb_api.py:106: in <module>
    requests_cache.backends.registry['tvdb_api_file_cache'] = FileCache
E   AttributeError: module 'requests_cache.backends' has no attribute 'registry'
=========================== short test summary info ============================
ERROR tests/test_tvdb_api.py - AttributeError: module 'requests_cache.backend...
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 0.23s ===============================
E: pybuild pybuild:388: test: plugin distutils failed with: exit code=2: cd /tmp/autopkgtest.0yx3p0/autopkgtest_tmp/build; python3.11 -m pytest tests

could you have a look at this too please? ideally try running the tests, as they may uncover more issues -- thanks!

It worked for me though (once it was integrated in the FreeBSD ports tree).

@sandrotosi
Copy link

I think this is fixed now. The error seemed to be only in the test code. It was using internals of requests-cache that have changed.

thanks, with the latest changes i can confirm all works for debian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

After python3.8 update I receive error
3 participants