From 127b5bba1a6c44b76bee7903695228320c35367c Mon Sep 17 00:00:00 2001 From: Rishi Diwan Date: Wed, 30 Aug 2023 17:46:31 +0530 Subject: [PATCH] Ensure test_url_for is only used during testing --- core/feed_protocol/annotator/circulation.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/feed_protocol/annotator/circulation.py b/core/feed_protocol/annotator/circulation.py index 3fac6a20e0..c1cf550679 100644 --- a/core/feed_protocol/annotator/circulation.py +++ b/core/feed_protocol/annotator/circulation.py @@ -3,6 +3,7 @@ import copy import datetime import logging +import os import urllib.error import urllib.parse import urllib.request @@ -239,7 +240,7 @@ def lane_url(self, lane: WorkList) -> str: return self.feed_url(lane) def url_for(self, *args: Any, **kwargs: Any) -> str: - if not has_request_context(): + if not has_request_context() and os.environ.get("TESTING", False): new_kwargs = {} for k, v in list(kwargs.items()): if not k.startswith("_"):