@@ -115,38 +115,38 @@ def test_generic_error(mock_urlopen, elasticapm_client):
115
115
116
116
117
117
def test_http_proxy_environment_variable (elasticapm_client ):
118
- with mock .patch .dict ("os.environ" , {"HTTP_PROXY" : "http://example.com" }):
118
+ with mock .patch .dict ("os.environ" , {"HTTP_PROXY" : "http://example.com" }, clear = True ):
119
119
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
120
120
assert isinstance (transport .http , urllib3 .ProxyManager )
121
121
122
122
123
123
def test_https_proxy_environment_variable (elasticapm_client ):
124
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" } ):
124
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" ,}, clear = True ):
125
125
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
126
126
assert isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
127
127
128
128
129
129
def test_https_proxy_environment_variable_is_preferred (elasticapm_client ):
130
- with mock .patch .dict ("os.environ" , {"https_proxy" : "https://example.com" , "HTTP_PROXY" : "http://example.com" }):
130
+ with mock .patch .dict ("os.environ" , {"https_proxy" : "https://example.com" , "HTTP_PROXY" : "http://example.com" }, clear = True ):
131
131
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
132
132
assert isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
133
133
assert transport .http .proxy .scheme == "https"
134
134
135
135
136
136
def test_no_proxy_star (elasticapm_client ):
137
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }):
137
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }, clear = True ):
138
138
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
139
139
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
140
140
141
141
142
142
def test_no_proxy_host (elasticapm_client ):
143
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "localhost" }):
143
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "localhost" }, clear = True ):
144
144
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
145
145
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
146
146
147
147
148
148
def test_no_proxy_all (elasticapm_client ):
149
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }):
149
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }, clear = True ):
150
150
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
151
151
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
152
152
0 commit comments