File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed
selenium/webdriver/common
test/selenium/webdriver/firefox Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,13 @@ def __init__(
6565 else :
6666 self .log_output = log_output
6767
68- self ._path = executable_path
6968 self .port = port or utils .free_port ()
7069 # Default value for every python subprocess: subprocess.Popen(..., creationflags=0)
7170 self .popen_kw = kwargs .pop ("popen_kw" , {})
7271 self .creation_flags = self .popen_kw .pop ("creation_flags" , 0 )
7372 self .env = env or os .environ
7473 self .DRIVER_PATH_ENV_KEY = driver_path_env_key
74+ self ._path = self .env_path () or executable_path
7575
7676 @property
7777 def service_url (self ) -> str :
Original file line number Diff line number Diff line change 1616# under the License.
1717import os
1818import subprocess
19+ import pytest
1920
2021from selenium .webdriver import Firefox
2122from selenium .webdriver .firefox .service import Service
@@ -54,3 +55,27 @@ def test_log_output_as_stdout(capfd) -> None:
5455 out , err = capfd .readouterr ()
5556 assert "geckodriver\t INFO\t Listening" in out
5657 driver .quit ()
58+
59+ @pytest .fixture
60+ def service ():
61+ return Service ()
62+
63+ @pytest .mark .usefixtures ("service" )
64+ class TestGeckoDriverService :
65+ service_path = "/path/to/geckodriver"
66+
67+ @pytest .fixture (autouse = True )
68+ def setup_and_teardown (self ):
69+ os .environ ['SE_GECKODRIVER' ] = self .service_path
70+ yield
71+ os .environ .pop ('SE_GECKODRIVER' , None )
72+
73+ def test_uses_path_from_env_variable (self , service ):
74+ assert 'geckodriver' in service .path
75+
76+ def test_updates_path_after_setting_env_variable (self , service ):
77+ new_path = "/foo/bar"
78+ os .environ ['SE_GECKODRIVER' ] = new_path
79+ service .executable_path = self .service_path # Simulating the update
80+
81+ assert 'geckodriver' in service .executable_path
You can’t perform that action at this time.
0 commit comments