Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ==> Making package: python-requests-cache 1.2.0-1 (Sat Feb 24 07:34:07 2024)
- ==> Retrieving sources...
- -> Downloading requests-cache-1.2.0.tar.gz...
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
- 100 2985k 0 2985k 0 0 2888k 0 --:--:-- 0:00:01 --:--:-- 9.8M
- ==> Validating source files with sha512sums...
- requests-cache-1.2.0.tar.gz ... Passed
- ==> Making package: python-requests-cache 1.2.0-1 (Sat Feb 24 07:34:09 2024)
- ==> Checking runtime dependencies...
- ==> Checking buildtime dependencies...
- ==> Retrieving sources...
- -> Found requests-cache-1.2.0.tar.gz
- ==> Validating source files with sha512sums...
- requests-cache-1.2.0.tar.gz ... Passed
- ==> Removing existing $srcdir/ directory...
- ==> Extracting sources...
- -> Extracting requests-cache-1.2.0.tar.gz with bsdtar
- bsdtar: Failed to set default locale
- ==> Sources are ready.
- python-requests-cache-1.2.0-1: parsing pkg list...
- ==> Making package: python-requests-cache 1.2.0-1 (Sat Feb 24 07:34:12 2024)
- ==> Checking runtime dependencies...
- ==> Checking buildtime dependencies...
- ==> WARNING: Using existing $srcdir/ tree
- ==> Starting build()...
- * Building wheel...
- Successfully built requests_cache-1.2.0-py3-none-any.whl
- ==> Starting check()...
- ============================================ test session starts =============================================
- platform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.4.0
- rootdir: /home/pieter/.cache/paru/clone/python-requests-cache/src/requests-cache-1.2.0
- plugins: requests-mock-1.11.0, socket-0.6.0, time-machine-2.13.0
- collected 381 items
- tests/compat/test_requests_mock_combine_cache.py . [ 0%]
- tests/compat/test_requests_mock_disable_cache.py . [ 0%]
- tests/compat/test_requests_mock_load_cache.py . [ 0%]
- tests/compat/test_responses_load_cache.py . [ 1%]
- tests/unit/test_base_cache.py ...................... [ 6%]
- tests/unit/test_cache_keys.py ............................. [ 14%]
- tests/unit/test_patcher.py ........... [ 17%]
- tests/unit/test_serializers.py ..s..... [ 19%]
- tests/unit/test_session.py ........................................................................... [ 39%]
- ............................................F................................................ [ 63%]
- tests/unit/models/test_base.py .. [ 64%]
- tests/unit/models/test_raw_response.py ...... [ 65%]
- tests/unit/models/test_request.py . [ 65%]
- tests/unit/models/test_response.py ................. [ 70%]
- tests/unit/policy/test_actions.py .................................................................... [ 88%]
- ...................... [ 93%]
- tests/unit/policy/test_expiration.py ....................... [100%]
- ================================================== FAILURES ==================================================
- ______________________________________ test_stale_if_error__error_code _______________________________________
- mock_session = <CachedSession(cache=<SQLiteCache(name=/tmp/pytest-of-pieter/pytest-0/test_stale_if_error__error_cod0/dc18728d-1220-41...(allowable_methods=('GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'), expire_after=1, stale_if_error=True))>
- @skip_pypy
- def test_stale_if_error__error_code(mock_session):
- """With stale_if_error, expect to get old cache data if a response has an error status code,
- that is not in allowable_codes.
- """
- mock_session.settings.stale_if_error = True
- mock_session.settings.expire_after = 1
- mock_session.settings.allowable_codes = (200,)
- with time_travel(START_DT):
- assert mock_session.get(MOCKED_URL_200_404).status_code == 200
- with time_travel(START_DT + timedelta(seconds=1.1)):
- response = mock_session.get(MOCKED_URL_200_404)
- assert response.status_code == 200
- assert response.from_cache is True
- > assert response.is_expired is True
- E AssertionError: assert False is True
- E + where False = CachedResponse(_content=b'', created_at='2024-02-24 07:34:13.140594+00:00', elapsed=datetime.timedelta(microseconds=80...od='GET', url='http+mock://requests-cache.com/200-404'), status_code=200, url='http+mock://requests-cache.com/200-404').is_expired
- tests/unit/test_session.py:475: AssertionError
- -------------------------------------------- Captured stdout call --------------------------------------------
- WARNING Request for URL session.py:307
- http+mock://requests-cache.com/200-404
- failed; using cached response
- ╭─ Traceback (most recent call last) ─╮
- │ /home/pieter/.cache/paru/clone/pyth │
- │ on-requests-cache/src/requests-cach │
- │ e-1.2.0/requests_cache/session.py:2 │
- │ 90 in _resend │
- │ │
- │ 287 │ │ │ │ self.settings │
- │ 288 │ │ │ │ and response. │
- │ 289 │ │ │ ): │
- │ ❱ 290 │ │ │ │ response.rais │
- │ 291 │ │ │ return response │
- │ 292 │ │ except Exception: │
- │ 293 │ │ │ return self._hand │
- │ │
- │ /usr/lib/python3.11/site-packages/r │
- │ equests/models.py:1021 in │
- │ raise_for_status │
- │ │
- │ 1018 │ │ │ ) │
- │ 1019 │ │ │
- │ 1020 │ │ if http_error_msg: │
- │ ❱ 1021 │ │ │ raise HTTPError( │
- │ 1022 │ │
- │ 1023 │ def close(self): │
- │ 1024 │ │ """Releases the conn │
- ╰─────────────────────────────────────╯
- HTTPError: 404 Client Error: None for
- url:
- http+mock://requests-cache.com/200-404
- --------------------------------------------- Captured log call ----------------------------------------------
- WARNING requests_cache.session:session.py:307 Request for URL http+mock://requests-cache.com/200-404 failed; using cached response
- Traceback (most recent call last):
- File "/home/pieter/.cache/paru/clone/python-requests-cache/src/requests-cache-1.2.0/requests_cache/session.py", line 290, in _resend
- response.raise_for_status()
- File "/usr/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
- raise HTTPError(http_error_msg, response=self)
- requests.exceptions.HTTPError: 404 Client Error: None for url: http+mock://requests-cache.com/200-404
- ========================================== short test summary info ===========================================
- FAILED tests/unit/test_session.py::test_stale_if_error__error_code - AssertionError: assert False is True
- ================================== 1 failed, 379 passed, 1 skipped in 4.40s ==================================
- ==> ERROR: A failure occurred in check().
- Aborting...
- error: failed to build 'python-requests-cache-1.2.0-1':
- error: packages failed to build: python-requests-cache-1.2.0-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement