Fix for newer requests-cache
These changes fix errors with newer requests-cache. Tested against requests-cache 0.9.8, the version in Debian 12.
Fixes https://github.com/dbr/tvnamer/issues/210#issuecomment-1207181564
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
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.
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!
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!
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 testscould 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.
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 testscould 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).
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