From 5cf5cde409997dcb4c91f01633d3779080719edb Mon Sep 17 00:00:00 2001 From: titusfortner <titus.fortner@gmail.com> Date: Mon, 13 Nov 2023 04:53:10 -0600 Subject: [PATCH] [py] fix black and flake8 linting issues NOKEYCHECK=True GitOrigin-RevId: db507155fd42156a504ec9ca4eda374b7f903ee0 --- conftest.py | 8 ++------ selenium/webdriver/common/driver_finder.py | 4 +--- selenium/webdriver/common/service.py | 8 ++------ test/selenium/webdriver/chrome/chrome_launcher_tests.py | 2 -- test/selenium/webdriver/chrome/chrome_service_tests.py | 1 - test/selenium/webdriver/common/selenium_manager_tests.py | 2 -- 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/conftest.py b/conftest.py index 61b0b959..0e5c6c31 100644 --- a/conftest.py +++ b/conftest.py @@ -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() diff --git a/selenium/webdriver/common/driver_finder.py b/selenium/webdriver/common/driver_finder.py index ec1dc2bd..6aa5f96e 100644 --- a/selenium/webdriver/common/driver_finder.py +++ b/selenium/webdriver/common/driver_finder.py @@ -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 diff --git a/selenium/webdriver/common/service.py b/selenium/webdriver/common/service.py index eaa32881..d9ed63d8 100644 --- a/selenium/webdriver/common/service.py +++ b/selenium/webdriver/common/service.py @@ -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( diff --git a/test/selenium/webdriver/chrome/chrome_launcher_tests.py b/test/selenium/webdriver/chrome/chrome_launcher_tests.py index f099d65c..95a22785 100644 --- a/test/selenium/webdriver/chrome/chrome_launcher_tests.py +++ b/test/selenium/webdriver/chrome/chrome_launcher_tests.py @@ -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): diff --git a/test/selenium/webdriver/chrome/chrome_service_tests.py b/test/selenium/webdriver/chrome/chrome_service_tests.py index 62e93a30..51c02521 100644 --- a/test/selenium/webdriver/chrome/chrome_service_tests.py +++ b/test/selenium/webdriver/chrome/chrome_service_tests.py @@ -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 diff --git a/test/selenium/webdriver/common/selenium_manager_tests.py b/test/selenium/webdriver/common/selenium_manager_tests.py index 7af110a5..a7693443 100644 --- a/test/selenium/webdriver/common/selenium_manager_tests.py +++ b/test/selenium/webdriver/common/selenium_manager_tests.py @@ -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