Skip to content

Instantly share code, notes, and snippets.

@Strykar
Created January 22, 2024 00:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Strykar/14b0f8bb18ba1ac9908e079fb9187e96 to your computer and use it in GitHub Desktop.
Save Strykar/14b0f8bb18ba1ac9908e079fb9187e96 to your computer and use it in GitHub Desktop.
Pyfa aur build fail log
Successfully built requests_cache-1.1.1-py3-none-any.whl
==> Starting check()...
========================================================================================================= test session starts ==========================================================================================================
platform linux -- Python 3.11.6, pytest-7.4.4, pluggy-1.3.0
rootdir: /tmp/makepkg/python-requests-cache/src/requests-cache-1.1.1
plugins: requests-mock-1.11.0, time-machine-2.13.0, socket-0.6.0
collected 379 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 ................................ [ 9%]
tests/unit/test_cache_keys.py ...................... [ 15%]
tests/unit/test_patcher.py ........... [ 18%]
tests/unit/test_serializers.py ..s..... [ 20%]
tests/unit/test_session.py ......................................................................................................................F............................................. [ 63%]
tests/unit/models/test_base.py .. [ 64%]
tests/unit/models/test_raw_response.py ....... [ 65%]
tests/unit/models/test_request.py . [ 66%]
tests/unit/models/test_response.py ............... [ 70%]
tests/unit/policy/test_actions.py .......................................................................................... [ 93%]
tests/unit/policy/test_expiration.py ....................... [100%]
=============================================================================================================== FAILURES ===============================================================================================================
___________________________________________________________________________________________________ test_stale_if_error__error_code ____________________________________________________________________________________________________
mock_session = <CachedSession(cache=<SQLiteCache(name=/tmp/pytest-of-strykar/pytest-1/test_stale_if_error__error_cod0/de33995c-590e-4..., 'HEAD', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'), always_revalidate=False, 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-01-22 00:25:19.841168', elapsed=datetime.timedelta(microseconds=70), exp...T', url='https://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:447: AssertionError
--------------------------------------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------------------------------------
WARNING Request for URL session.py:277
https://http+mock/requests-cache.com/20
0-404 failed; using cached response
╭─ Traceback (most recent call last) ─╮
│ /tmp/makepkg/python-requests-cache/ │
│ src/requests-cache-1.1.1/requests_c │
│ ache/session.py:260 in _resend │
│ │
│ 257 │ │ │ │ self.settings │
│ 258 │ │ │ │ and response. │
│ 259 │ │ │ ): │
│ ❱ 260 │ │ │ │ response.rais │
│ 261 │ │ │ return response │
│ 262 │ │ except Exception: │
│ 263 │ │ │ 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:277 Request for URL https://http+mock/requests-cache.com/200-404 failed; using cached response
Traceback (most recent call last):
File "/tmp/makepkg/python-requests-cache/src/requests-cache-1.1.1/requests_cache/session.py", line 260, 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
=========================================================================================================== warnings summary ===========================================================================================================
tests/unit/test_base_cache.py::test_has_key
/tmp/makepkg/python-requests-cache/src/requests-cache-1.1.1/tests/unit/test_base_cache.py:354: DeprecationWarning: BaseCache.has_key() is deprecated; please use .contains() instead
assert mock_session.cache.has_key('12345')
tests/unit/test_base_cache.py::test_has_key
/tmp/makepkg/python-requests-cache/src/requests-cache-1.1.1/tests/unit/test_base_cache.py:355: DeprecationWarning: BaseCache.has_key() is deprecated; please use .contains() instead
assert not mock_session.cache.has_key('1234')
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================= short test summary info ========================================================================================================
FAILED tests/unit/test_session.py::test_stale_if_error__error_code - AssertionError: assert False is True
========================================================================================= 1 failed, 377 passed, 1 skipped, 2 warnings in 4.41s =========================================================================================
==> ERROR: A failure occurred in check().
Aborting...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment