From 757f298a30452641a6603f7238db53534b267687 Mon Sep 17 00:00:00 2001 From: manuzhang Date: Thu, 28 Aug 2025 11:34:46 +0800 Subject: [PATCH 1/3] Fix rest test with ssl_ca_bundle due to conflicts with OS environment --- tests/catalog/test_rest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py index 0c3e1ce8cd..eaa04aec69 100644 --- a/tests/catalog/test_rest.py +++ b/tests/catalog/test_rest.py @@ -1496,6 +1496,10 @@ def test_request_session_with_ssl_ca_bundle() -> None: }, } with pytest.raises(OSError) as e: + if "REQUESTS_CA_BUNDLE" in os.environ: + os.environ.pop("REQUESTS_CA_BUNDLE") + if "CURL_CA_BUNDLE" in os.environ: + os.environ.pop("CURL_CA_BUNDLE") # Missing namespace RestCatalog("rest", **catalog_properties) # type: ignore assert "Could not find a suitable TLS CA certificate bundle, invalid path: path_to_ca_bundle" in str(e.value) From 6329d85ec249f187c1728f9b4f1b742a0ec022da Mon Sep 17 00:00:00 2001 From: manuzhang Date: Fri, 29 Aug 2025 01:11:44 +0800 Subject: [PATCH 2/3] Use monkeypatch.delenv --- tests/catalog/test_rest.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py index eaa04aec69..1d1dd705c8 100644 --- a/tests/catalog/test_rest.py +++ b/tests/catalog/test_rest.py @@ -1486,7 +1486,7 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non assert "Empty namespace identifier" in str(e.value) -def test_request_session_with_ssl_ca_bundle() -> None: +def test_request_session_with_ssl_ca_bundle(monkeypatch) -> None: # Given catalog_properties = { "uri": TEST_URI, @@ -1496,10 +1496,8 @@ def test_request_session_with_ssl_ca_bundle() -> None: }, } with pytest.raises(OSError) as e: - if "REQUESTS_CA_BUNDLE" in os.environ: - os.environ.pop("REQUESTS_CA_BUNDLE") - if "CURL_CA_BUNDLE" in os.environ: - os.environ.pop("CURL_CA_BUNDLE") + monkeypatch.delenv("REQUESTS_CA_BUNDLE", raising=False) + monkeypatch.delenv("CURL_CA_BUNDLE", raising=False) # Missing namespace RestCatalog("rest", **catalog_properties) # type: ignore assert "Could not find a suitable TLS CA certificate bundle, invalid path: path_to_ca_bundle" in str(e.value) From 99649964628ab2c253b1012d83ef8bf746f39ac2 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Thu, 28 Aug 2025 22:04:06 +0200 Subject: [PATCH 3/3] Patch --- tests/catalog/test_rest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/catalog/test_rest.py b/tests/catalog/test_rest.py index 1d1dd705c8..261910575f 100644 --- a/tests/catalog/test_rest.py +++ b/tests/catalog/test_rest.py @@ -1486,7 +1486,7 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non assert "Empty namespace identifier" in str(e.value) -def test_request_session_with_ssl_ca_bundle(monkeypatch) -> None: +def test_request_session_with_ssl_ca_bundle(monkeypatch: pytest.MonkeyPatch) -> None: # Given catalog_properties = { "uri": TEST_URI,