|  | 
| 30 | 30 |     DEFAULT_TIMEOUT, | 
| 31 | 31 |     HTTPX_DEFAULT_TIMEOUT, | 
| 32 | 32 |     BaseClient, | 
|  | 33 | +    DefaultHttpxClient, | 
|  | 34 | +    DefaultAsyncHttpxClient, | 
| 33 | 35 |     make_request_options, | 
| 34 | 36 | ) | 
| 35 | 37 | 
 | 
| @@ -826,6 +828,28 @@ def retry_handler(_request: httpx.Request) -> httpx.Response: | 
| 826 | 828 | 
 | 
| 827 | 829 |         assert response.http_request.headers.get("x-stainless-retry-count") == "42" | 
| 828 | 830 | 
 | 
|  | 831 | +    def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: | 
|  | 832 | +        # Test that the proxy environment variables are set correctly | 
|  | 833 | +        monkeypatch.setenv("HTTPS_PROXY", "https://example.org") | 
|  | 834 | + | 
|  | 835 | +        client = DefaultHttpxClient() | 
|  | 836 | + | 
|  | 837 | +        mounts = tuple(client._mounts.items()) | 
|  | 838 | +        assert len(mounts) == 1 | 
|  | 839 | +        assert mounts[0][0].pattern == "https://" | 
|  | 840 | + | 
|  | 841 | +    @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") | 
|  | 842 | +    def test_default_client_creation(self) -> None: | 
|  | 843 | +        # Ensure that the client can be initialized without any exceptions | 
|  | 844 | +        DefaultHttpxClient( | 
|  | 845 | +            verify=True, | 
|  | 846 | +            cert=None, | 
|  | 847 | +            trust_env=True, | 
|  | 848 | +            http1=True, | 
|  | 849 | +            http2=False, | 
|  | 850 | +            limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), | 
|  | 851 | +        ) | 
|  | 852 | + | 
| 829 | 853 |     @pytest.mark.respx(base_url=base_url) | 
| 830 | 854 |     def test_follow_redirects(self, respx_mock: MockRouter) -> None: | 
| 831 | 855 |         # Test that the default follow_redirects=True allows following redirects | 
| @@ -1679,6 +1703,28 @@ async def test_main() -> None: | 
| 1679 | 1703 | 
 | 
| 1680 | 1704 |                 time.sleep(0.1) | 
| 1681 | 1705 | 
 | 
|  | 1706 | +    async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: | 
|  | 1707 | +        # Test that the proxy environment variables are set correctly | 
|  | 1708 | +        monkeypatch.setenv("HTTPS_PROXY", "https://example.org") | 
|  | 1709 | + | 
|  | 1710 | +        client = DefaultAsyncHttpxClient() | 
|  | 1711 | + | 
|  | 1712 | +        mounts = tuple(client._mounts.items()) | 
|  | 1713 | +        assert len(mounts) == 1 | 
|  | 1714 | +        assert mounts[0][0].pattern == "https://" | 
|  | 1715 | + | 
|  | 1716 | +    @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") | 
|  | 1717 | +    async def test_default_client_creation(self) -> None: | 
|  | 1718 | +        # Ensure that the client can be initialized without any exceptions | 
|  | 1719 | +        DefaultAsyncHttpxClient( | 
|  | 1720 | +            verify=True, | 
|  | 1721 | +            cert=None, | 
|  | 1722 | +            trust_env=True, | 
|  | 1723 | +            http1=True, | 
|  | 1724 | +            http2=False, | 
|  | 1725 | +            limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), | 
|  | 1726 | +        ) | 
|  | 1727 | + | 
| 1682 | 1728 |     @pytest.mark.respx(base_url=base_url) | 
| 1683 | 1729 |     async def test_follow_redirects(self, respx_mock: MockRouter) -> None: | 
| 1684 | 1730 |         # Test that the default follow_redirects=True allows following redirects | 
|  | 
0 commit comments