@@ -115,38 +115,46 @@ 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 (
125
+ "os.environ" ,
126
+ {
127
+ "HTTPS_PROXY" : "https://example.com" ,
128
+ },
129
+ clear = True ,
130
+ ):
125
131
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
126
132
assert isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
127
133
128
134
129
135
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" }):
136
+ with mock .patch .dict (
137
+ "os.environ" , {"https_proxy" : "https://example.com" , "HTTP_PROXY" : "http://example.com" }, clear = True
138
+ ):
131
139
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
132
140
assert isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
133
141
assert transport .http .proxy .scheme == "https"
134
142
135
143
136
144
def test_no_proxy_star (elasticapm_client ):
137
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }):
145
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }, clear = True ):
138
146
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
139
147
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
140
148
141
149
142
150
def test_no_proxy_host (elasticapm_client ):
143
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "localhost" }):
151
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "localhost" }, clear = True ):
144
152
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
145
153
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
146
154
147
155
148
156
def test_no_proxy_all (elasticapm_client ):
149
- with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }):
157
+ with mock .patch .dict ("os.environ" , {"HTTPS_PROXY" : "https://example.com" , "NO_PROXY" : "*" }, clear = True ):
150
158
transport = Transport ("http://localhost:9999" , client = elasticapm_client )
151
159
assert not isinstance (transport .http , urllib3 .poolmanager .ProxyManager )
152
160
0 commit comments