Skip to content

Commit 0134992

Browse files
committed
[py] Update dependencies and other fixes
1 parent 5524886 commit 0134992

File tree

4 files changed

+41
-46
lines changed

4 files changed

+41
-46
lines changed

py/conftest.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
import socket
2121
import subprocess
2222
import time
23-
from test.selenium.webdriver.common.network import get_lan_ip
24-
from test.selenium.webdriver.common.webserver import SimpleWebServer
2523
from urllib.request import urlopen
2624

2725
import pytest
2826

2927
from selenium import webdriver
28+
from test.selenium.webdriver.common.network import get_lan_ip
29+
from test.selenium.webdriver.common.webserver import SimpleWebServer
3030

3131
drivers = (
3232
"chrome",
@@ -113,10 +113,8 @@ def get_driver_class(driver_option):
113113
@pytest.fixture(scope="function")
114114
def driver(request):
115115
kwargs = {}
116-
117116
# browser can be changed with `--driver=firefox` as an argument or to addopts in pytest.ini
118117
driver_class = get_driver_class(getattr(request, "param", "Chrome"))
119-
120118
# skip tests if not available on the platform
121119
_platform = platform.system()
122120
if driver_class == "Safari" and _platform != "Darwin":
@@ -125,12 +123,10 @@ def driver(request):
125123
pytest.skip("IE and EdgeHTML Tests can only run on Windows")
126124
if "WebKit" in driver_class and _platform == "Windows":
127125
pytest.skip("WebKit tests cannot be run on Windows")
128-
129126
# skip tests for drivers that don't support BiDi when --bidi is enabled
130127
if request.config.option.bidi:
131128
if driver_class in ("Ie", "Safari", "WebKitGTK", "WPEWebKit"):
132129
pytest.skip(f"{driver_class} does not support BiDi")
133-
134130
# conditionally mark tests as expected to fail based on driver
135131
marker = request.node.get_closest_marker(f"xfail_{driver_class.lower()}")
136132

@@ -184,7 +180,6 @@ def fin():
184180

185181
driver_instance = getattr(webdriver, driver_class)(**kwargs)
186182
yield driver_instance
187-
188183
# Close the browser after BiDi tests. Those make event subscriptions
189184
# and doesn't seems to be stable enough, causing the flakiness of the
190185
# subsequent tests.

py/pyproject.toml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,24 +135,34 @@ ignore_missing_imports = true
135135
# Automatically keep imports alphabetically sorted, on single lines in
136136
# PEP recommended sections (https://peps.python.org/pep-0008/#imports)
137137
# files or individual lines can be ignored via `# isort:skip|# isort:skip_file`.
138-
profile = "black"
139-
py_version=39
140138
force_single_line = true
139+
profile = "black"
140+
py_version = 39
141+
only_modified = true
141142

142143
[tool.black]
143-
extend-exclude = 'selenium/webdriver/common/devtools'
144+
extend-exclude = "selenium/webdriver/common/devtools"
144145
line-length = 120
145-
target-version = ['py39']
146+
target-version = ["py39"]
146147

147148
[tool.autoflake]
148-
exclude = "*/devtools/*"
149+
exclude = "selenium/webdriver/common/devtools"
149150
ignore-pass-after-docstring = true
150151
in-place = true
152+
quiet = true
151153
recursive = true
152154
remove-duplicate-keys = true
153155
remove-unused-variables = true
154156

157+
[tool.flake8]
158+
exclude = "selenium/webdriver/common/devtools"
159+
# Disable E501 once line length is better handled
160+
extend-ignore = ["E501", "E203"]
161+
# This does nothing for now as E501 is ignored
162+
max-line-length = 120
163+
min-python-version = 3.9
164+
155165
[tool.docformatter]
156-
exclude = 'selenium/webdriver/common/devtools'
166+
exclude = "selenium/webdriver/common/devtools"
157167
in-place = true
158168
recursive = true

py/selenium/webdriver/support/expected_conditions.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _predicate(driver: WebDriver):
195195

196196

197197
def visibility_of_element_located(
198-
locator: Tuple[str, str]
198+
locator: Tuple[str, str],
199199
) -> Callable[[WebDriverOrWebElement], Union[Literal[False], WebElement]]:
200200
"""An expectation for checking that an element is present on the DOM of a
201201
page and visible. Visibility means that the element is not only displayed
@@ -337,7 +337,7 @@ def _predicate(driver: WebDriverOrWebElement):
337337

338338

339339
def visibility_of_all_elements_located(
340-
locator: Tuple[str, str]
340+
locator: Tuple[str, str],
341341
) -> Callable[[WebDriverOrWebElement], Union[List[WebElement], Literal[False]]]:
342342
"""An expectation for checking that all elements are present on the DOM of
343343
a page and visible. Visibility means that the elements are not only
@@ -486,7 +486,7 @@ def _predicate(driver: WebDriverOrWebElement):
486486

487487

488488
def frame_to_be_available_and_switch_to_it(
489-
locator: Union[Tuple[str, str], str, WebElement]
489+
locator: Union[Tuple[str, str], str, WebElement],
490490
) -> Callable[[WebDriver], bool]:
491491
"""An expectation for checking whether the given frame is available to
492492
switch to.
@@ -527,7 +527,7 @@ def _predicate(driver: WebDriver):
527527

528528

529529
def invisibility_of_element_located(
530-
locator: Union[WebElement, Tuple[str, str]]
530+
locator: Union[WebElement, Tuple[str, str]],
531531
) -> Callable[[WebDriverOrWebElement], Union[WebElement, bool]]:
532532
"""An Expectation for checking that an element is either invisible or not
533533
present on the DOM.
@@ -576,7 +576,7 @@ def _predicate(driver: WebDriverOrWebElement):
576576

577577

578578
def invisibility_of_element(
579-
element: Union[WebElement, Tuple[str, str]]
579+
element: Union[WebElement, Tuple[str, str]],
580580
) -> Callable[[WebDriverOrWebElement], Union[WebElement, bool]]:
581581
"""An Expectation for checking that an element is either invisible or not
582582
present on the DOM.
@@ -602,7 +602,7 @@ def invisibility_of_element(
602602

603603

604604
def element_to_be_clickable(
605-
mark: Union[WebElement, Tuple[str, str]]
605+
mark: Union[WebElement, Tuple[str, str]],
606606
) -> Callable[[WebDriverOrWebElement], Union[Literal[False], WebElement]]:
607607
"""An Expectation for checking an element is visible and enabled such that
608608
you can click it.

py/tox.ini

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ envlist = docs, flake8, isort, validate-pyproject
44
[testenv:validate-pyproject]
55
skip_install = true
66
deps =
7-
validate-pyproject==0.23
8-
packaging==24.2
7+
validate-pyproject==0.24.1
8+
packaging==25.0
99
commands =
1010
validate-pyproject ./pyproject.toml
1111

@@ -33,25 +33,21 @@ deps =
3333
commands = mypy --install-types {posargs}
3434

3535
[testenv:linting-ci]
36-
; checks linting for CI with stricter exiting when failing.
36+
; checks linting for CI with stricter exiting when failing and no rewriting
3737
skip_install = true
3838
deps =
39-
isort==5.13.2
40-
black==24.1.1
39+
isort==6.0.1
40+
black==25.1.0
4141
autoflake==2.3.1
42-
flake8==6.1.0
43-
flake8-typing-imports==1.14.0
42+
flake8==7.1.2
43+
flake8-pyproject==1.2.3
44+
flake8-typing-imports==1.16.0
4445
docformatter==1.7.5
4546
commands =
46-
; execute isort in check only mode with diff
4747
isort --check-only --diff selenium/ test/ conftest.py
48-
; execute black in check only mode with diff
49-
black --check --diff selenium/ test/ conftest.py -l 120
50-
; execute autoflake in check only mode with diff
48+
black --check --diff selenium/ test/ conftest.py
5149
autoflake --check-diff selenium/ test/ conftest.py
52-
; execute flake8
53-
flake8 selenium/ test/ --min-python-version=3.9
54-
; execute docformatter in check only mode with diff
50+
flake8 selenium/ test/ conftest.py
5551
docformatter --check --diff selenium/
5652

5753
[testenv:linting]
@@ -66,22 +62,16 @@ commands =
6662
; - flake8 merely alerts to the failure
6763
skip_install = true
6864
deps =
69-
isort==5.13.2
70-
black==24.1.1
65+
isort==6.0.1
66+
black==25.1.0
7167
autoflake==2.3.1
72-
flake8==6.1.0
73-
flake8-typing-imports==1.14.0
68+
flake8==7.1.2
69+
flake8-pyproject==1.2.3
70+
flake8-typing-imports==1.16.0
7471
docformatter==1.7.5
7572
commands =
7673
isort selenium/ test/ conftest.py
77-
black selenium/ test/ conftest.py -l 120
74+
black selenium/ test/ conftest.py
7875
autoflake selenium/ test/ conftest.py
79-
flake8 selenium/ test/ --min-python-version=3.9
76+
flake8 selenium/ test/ conftest.py
8077
docformatter selenium/
81-
82-
[flake8]
83-
exclude = .tox,selenium/webdriver/common/devtools,docs/source/conf.py,*venv
84-
# Disable this once black is applied throughout & line length is better handled.
85-
extend-ignore = E501, E203
86-
# This does nothing for now as E501 is ignored.
87-
max-line-length = 120

0 commit comments

Comments
 (0)