File tree 1 file changed +10
-9
lines changed 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 1
1
import pytest
2
2
import yaml
3
3
import kubernetes
4
- import os
5
4
from testcontainers .k3s import K3SContainer
6
5
7
6
from ocp_resources .exceptions import ResourceTeardownError
@@ -106,14 +105,16 @@ def test_resource_context_manager_exit(self, client):
106
105
with TestSecretExit (name = "test-context-manager-exit" , namespace = "default" , client = client ):
107
106
pass
108
107
109
- def test_proxy_conflict_raises_value_error (self ):
110
- os .environ ["OPENSHIFT_PYTHON_WRAPPER_CLIENT_USE_PROXY" ] = "1"
111
- os .environ ["HTTPS_PROXY" ] = "http://env-proxy.com"
108
+ def test_proxy_conflict_raises_value_error (self , monkeypatch ):
109
+ monkeypatch .setenv (name = "OPENSHIFT_PYTHON_WRAPPER_CLIENT_USE_PROXY" , value = "1" )
110
+ monkeypatch .setenv (name = "HTTPS_PROXY" , value = "http://env-proxy.com" )
111
+
112
112
client_configuration = kubernetes .client .Configuration ()
113
113
client_configuration .proxy = "http://not-env-proxy.com"
114
- with pytest .raises (
115
- ValueError ,
116
- match = "Conflicting proxy settings: client_configuration.proxy=http://not-env-proxy.com, "
117
- "but the environment variable 'OPENSHIFT_PYTHON_WRAPPER_CLIENT_USE_PROXY' defines proxy as http://env-proxy.com." ,
118
- ):
114
+
115
+ with pytest .raises (ValueError ) as exc_info :
119
116
get_client (client_configuration = client_configuration )
117
+
118
+ assert "Conflicting proxy settings" in str (exc_info .value )
119
+ assert "http://not-env-proxy.com" in str (exc_info .value )
120
+ assert "http://env-proxy.com" in str (exc_info .value )
You can’t perform that action at this time.
0 commit comments