Skip to content

Commit f085ea2

Browse files
[py] Fix Proxy tests to work with pin_browsers
1 parent b8819d5 commit f085ea2

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

py/test/selenium/webdriver/chrome/proxy_tests.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,25 @@
1919
import os
2020
import urllib3
2121

22+
from selenium import webdriver
23+
2224

2325
@pytest.mark.no_driver_after_test
2426
def test_bad_proxy_doesnt_interfere(clean_driver, clean_service):
2527
# these values should be ignored if ignore_local_proxy_environment_variables() is called.
2628
os.environ["https_proxy"] = "bad"
2729
os.environ["http_proxy"] = "bad"
30+
2831
options = webdriver.ChromeOptions()
2932

3033
options.ignore_local_proxy_environment_variables()
3134

3235
chrome_kwargs = {"options": options, "service": clean_service}
3336
driver = clean_driver(**chrome_kwargs)
3437

35-
try:
36-
assert hasattr(driver, "command_executor")
37-
assert hasattr(driver.command_executor, "_proxy_url")
38-
assert isinstance(driver.command_executor._conn, urllib3.PoolManager)
39-
finally:
40-
os.environ.pop("https_proxy")
41-
os.environ.pop("http_proxy")
42-
driver.quit()
38+
assert hasattr(driver, "command_executor")
39+
assert hasattr(driver.command_executor, "_proxy_url")
40+
assert isinstance(driver.command_executor._conn, urllib3.PoolManager)
41+
os.environ.pop("https_proxy")
42+
os.environ.pop("http_proxy")
43+
driver.quit()

0 commit comments

Comments
 (0)