You've already forked macports-ports
mirror of
https://github.com/macports/macports-ports.git
synced 2026-03-31 14:42:53 -07:00
52 lines
1.9 KiB
Diff
52 lines
1.9 KiB
Diff
https://github.com/requests-cache/requests-cache/commit/94a98bda63dc8f7cb7e931063843cbd17c613905
|
||
|
||
From 9e6a50fc629cd1bd2c674911179f2e4f35b8f97e Mon Sep 17 00:00:00 2001
|
||
From: Mark Mentovai <mark@mentovai.com>
|
||
Date: Thu, 27 Nov 2025 00:31:18 -0500
|
||
Subject: [PATCH] Fix 2 test_session time_travel tests
|
||
MIME-Version: 1.0
|
||
Content-Type: text/plain; charset=UTF-8
|
||
Content-Transfer-Encoding: 8bit
|
||
|
||
The assertions on response.is_expired could fail, because
|
||
CachedResponse.is_expired compares a resource’s expiration time to the
|
||
current time, and this comparison was being done outside of the scope of
|
||
the time-altering time_travel context manager.
|
||
---
|
||
tests/unit/test_session.py | 12 ++++++------
|
||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||
|
||
diff --git tests/unit/test_session.py tests/unit/test_session.py
|
||
index 5e29881a30b5..b4de166c3e48 100644
|
||
--- tests/unit/test_session.py
|
||
+++ tests/unit/test_session.py
|
||
@@ -475,9 +475,9 @@ def test_stale_if_error__error_code(url, mock_session):
|
||
with time_travel(START_DT + timedelta(seconds=1.1)):
|
||
response = mock_session.get(url)
|
||
|
||
- assert response.status_code == 200
|
||
- assert response.from_cache is True
|
||
- assert response.is_expired is True
|
||
+ assert response.status_code == 200
|
||
+ assert response.from_cache is True
|
||
+ assert response.is_expired is True
|
||
|
||
|
||
@skip_pypy
|
||
@@ -496,9 +496,9 @@ def test_stale_if_error__error_code_in_allowable_codes(url, mock_session):
|
||
with time_travel(START_DT + timedelta(seconds=1.1)):
|
||
response = mock_session.get(url)
|
||
|
||
- assert response.status_code == 404
|
||
- assert response.from_cache is False
|
||
- assert response.is_expired is False
|
||
+ assert response.status_code == 404
|
||
+ assert response.from_cache is False
|
||
+ assert response.is_expired is False
|
||
|
||
|
||
@pytest.mark.parametrize('url', [MOCKED_URL_200_404, MOCKED_URL_ETAG_200_404])
|
||
--
|
||
2.52.0
|
||
|