0

[py] fix black and flake8 linting issues

NOKEYCHECK=True
GitOrigin-RevId: db507155fd42156a504ec9ca4eda374b7f903ee0
This commit is contained in:
titusfortner
2023-11-13 04:53:10 -06:00
committed by Copybara-Service
parent af29d81a20
commit 5cf5cde409
6 changed files with 5 additions and 20 deletions

@ -137,9 +137,7 @@ def driver(request):
if driver_class == "Chrome":
options = get_options(driver_class, request.config)
if driver_class == "Remote":
options = (
get_options("Firefox", request.config) or webdriver.FirefoxOptions()
)
options = get_options("Firefox", request.config) or webdriver.FirefoxOptions()
options.set_capability("moz:firefoxOptions", {})
options.enable_downloads = True
if driver_class == "WebKitGTK":
@ -282,9 +280,7 @@ def server(request):
]
)
print(f"Selenium server running as process: {process.pid}")
assert wait_for_server(
url, 10
), f"Timed out waiting for Selenium server at {url}"
assert wait_for_server(url, 10), f"Timed out waiting for Selenium server at {url}"
print("Selenium server is ready")
yield process
process.terminate()

@ -41,8 +41,6 @@ class DriverFinder:
raise NoSuchDriverException(msg) from err
if path is None or not Path(path).is_file():
raise NoSuchDriverException(
f"Unable to locate or obtain driver for {options.capabilities['browserName']}"
)
raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")
return path

@ -112,9 +112,7 @@ class Service(ABC):
"""Check if the underlying process is still running."""
return_code = self.process.poll()
if return_code:
raise WebDriverException(
f"Service {self._path} unexpectedly exited. Status code was: {return_code}"
)
raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
def is_connectable(self) -> bool:
"""Establishes a socket connection to determine if the service running
@ -204,9 +202,7 @@ class Service(ABC):
start_info = None
if system() == "Windows":
start_info = subprocess.STARTUPINFO()
start_info.dwFlags = (
subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
)
start_info.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
start_info.wShowWindow = subprocess.SW_HIDE
self.process = subprocess.Popen(

@ -17,8 +17,6 @@
import pytest
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
@pytest.mark.no_driver_after_test
def test_launch_and_close_browser(clean_driver, clean_service):

@ -21,7 +21,6 @@ import time
import pytest
from selenium.common.exceptions import WebDriverException
from selenium.webdriver import Chrome
from selenium.webdriver.chrome.service import Service

@ -21,8 +21,6 @@ import pytest
from selenium.common.exceptions import WebDriverException
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.driver_finder import DriverFinder
from selenium.webdriver.common.proxy import Proxy
from selenium.webdriver.common.selenium_manager import SeleniumManager