Taragolis commented on code in PR #39799:
URL: https://github.com/apache/airflow/pull/39799#discussion_r1613540810


##########
tests/utils/test_log_handlers.py:
##########
@@ -779,3 +782,65 @@ def test_permissions_for_new_directories(tmp_path):
         assert base_dir.stat().st_mode % 0o1000 == default_permissions
     finally:
         os.umask(old_umask)
+
+
+worker_url = "http://10.240.5.168:8793";
+log_location = 
"dag_id=sample/run_id=manual__2024-05-23T07:18:59.298882+00:00/task_id=sourcing/attempt=1.log"
+log_url = f"{worker_url}/log/{log_location}"
+
+
+@pytest.fixture
+def http_proxy():
+    _origin_http_proxy = os.getenv("http_proxy") or ""
+    os.environ["http_proxy"] = "http://proxy.example.com";
+    yield
+    os.environ["http_proxy"] = _origin_http_proxy

Review Comment:
   I would recommend to use 
[monkeypatch](https://docs.pytest.org/en/latest/how-to/monkeypatch.html) 
fixture, which already included into the `pytest`. It care about rollback in 
the end of test case
   
   ```suggestion
   def http_proxy(monkeypatch):
       monkeypatch.setenv("http_proxy", "http://proxy.example.com";)
   ```
   
   or you could just provide this fixture into the your test case directly and 
use there
       



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to