Skip to content

Commit c3c314d

Browse files
manuzhangFokko
andauthored
Fix rest test with ssl_ca_bundle due to conflicts with OS environment (apache#2394)
# Rationale for this change Request sessions could load `REQUESTS_CA_BUNDLE` or `CURL_CA_BUNDLE` from OS environment such that cabundle passed in from the UT is not used. https://github.com/psf/requests/blob/88dce9d854797c05d0ff296b70e0430535ef8aaf/src/requests/sessions.py#L766-L771 ## Are these changes tested? Yes ## Are there any user-facing changes? No --------- Co-authored-by: Fokko Driesprong <[email protected]>
1 parent 52ff684 commit c3c314d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/catalog/test_rest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non
14861486
assert "Empty namespace identifier" in str(e.value)
14871487

14881488

1489-
def test_request_session_with_ssl_ca_bundle() -> None:
1489+
def test_request_session_with_ssl_ca_bundle(monkeypatch: pytest.MonkeyPatch) -> None:
14901490
# Given
14911491
catalog_properties = {
14921492
"uri": TEST_URI,
@@ -1496,6 +1496,8 @@ def test_request_session_with_ssl_ca_bundle() -> None:
14961496
},
14971497
}
14981498
with pytest.raises(OSError) as e:
1499+
monkeypatch.delenv("REQUESTS_CA_BUNDLE", raising=False)
1500+
monkeypatch.delenv("CURL_CA_BUNDLE", raising=False)
14991501
# Missing namespace
15001502
RestCatalog("rest", **catalog_properties) # type: ignore
15011503
assert "Could not find a suitable TLS CA certificate bundle, invalid path: path_to_ca_bundle" in str(e.value)

0 commit comments

Comments
 (0)