Skip to content

Commit

Permalink
[py] Fix test for CONDA_PREFIX in selenium_manager
Browse files Browse the repository at this point in the history
Accessing CONDA_PREFIX in os.environ fails with a KeyError when it is
not set. The condition should instead check for the existence of the
key, before accessing it in the following codepath

Fixes: d4285d1 ("fix for conda install of selenium-manager (SeleniumHQ#12536)")
  • Loading branch information
mweinelt committed Oct 30, 2023
1 parent f51583b commit c158a79
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion py/selenium/webdriver/common/selenium_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_binary() -> Path:

path = Path(__file__).parent.joinpath(directory, file)

if not path.is_file() and os.environ["CONDA_PREFIX"]:
if not path.is_file() and "CONDA_PREFIX" in os.environ:
# conda has a separate package selenium-manager, installs in bin
path = Path(os.path.join(os.environ["CONDA_PREFIX"], "bin", file))
logger.debug("Conda environment detected, using `%s`", path)
Expand Down

0 comments on commit c158a79

Please sign in to comment.