Skip to content

Commit 3d24b90

Browse files
committed
uv
1 parent dd19ba0 commit 3d24b90

File tree

7 files changed

+17
-49
lines changed

7 files changed

+17
-49
lines changed

.pre-commit-config.yaml

+10-30
Original file line numberDiff line numberDiff line change
@@ -35,33 +35,14 @@ repos:
3535
- id: conventional-pre-commit
3636
stages: [commit-msg]
3737
args: []
38-
- repo: https://github.com/psf/black
39-
rev: 25.1.0
40-
hooks:
41-
- id: black
42-
language_version: python3
43-
args: [ '--config', 'pyproject.toml' ]
44-
- repo: https://github.com/PyCQA/autoflake
45-
rev: v2.3.1
46-
hooks:
47-
- id: autoflake
48-
args:
49-
[
50-
'--in-place',
51-
'--remove-unused-variable',
52-
'--remove-all-unused-imports',
53-
'--expand-star-imports',
54-
'--ignore-init-module-imports',
55-
]
56-
- repo: https://github.com/PyCQA/isort
57-
rev: 6.0.1
58-
hooks:
59-
- id: isort
60-
args: [ '--settings-file', 'pyproject.toml' ]
61-
- repo: https://github.com/asottile/pyupgrade
62-
rev: v3.19.1
63-
hooks:
64-
- id: pyupgrade
38+
- repo: https://github.com/astral-sh/ruff-pre-commit
39+
rev: v0.11.4
40+
hooks:
41+
- id: ruff
42+
args: [ --fix ]
43+
continue_on_error: true
44+
- id: ruff-format
45+
continue_on_error: true
6546
- repo: https://github.com/codespell-project/codespell
6647
rev: v2.4.1
6748
hooks:
@@ -72,11 +53,10 @@ repos:
7253
rev: v0.24.1
7354
hooks:
7455
- id: validate-pyproject
75-
# Optional extra validations from SchemaStore:
76-
additional_dependencies: [ "validate-pyproject-schema-store[all]" ]
56+
additional_dependencies: ["validate-pyproject-schema-store[all]"]
7757
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
7858
rev: v2.14.0
7959
hooks:
8060
- id: pretty-format-toml
8161
exclude: poetry.lock
82-
args: [ --autofix ]
62+
args: [--autofix]

pages/login_page.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from dataclasses import dataclass
2-
from typing import Union
32

43
import allure
54
from playwright.sync_api import Page
@@ -19,7 +18,7 @@ def __init__(self, page: Page):
1918
self.error_message = page.get_by_test_id("error")
2019

2120
@allure.step("Login with username {username} and password {password}")
22-
def login(self, username: Union[User, str], password: str):
21+
def login(self, username: User | str, password: str):
2322
if hasattr(username, "value"):
2423
self.user_name_field.fill(username.value)
2524
else:

tests/checkout_test.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66

77
class TestCheckout:
8-
@pytest.mark.parametrize(
9-
"browser_context_args", [User.STANDARD_USER], indirect=True
10-
)
8+
@pytest.mark.parametrize("browser_context_args", [User.STANDARD_USER], indirect=True)
119
def test_checkout_counter(self, browser_context_args, page: Page):
1210
page.evaluate("localStorage.setItem('cart-contents', '[4,0]');")
1311
page.reload()

tests/conftest.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ def axe_playwright():
4848

4949

5050
@pytest.fixture(scope="function")
51-
def browser_context_args(
52-
browser_context_args: dict, base_url: str, request: SubRequest
53-
):
51+
def browser_context_args(browser_context_args: dict, base_url: str, request: SubRequest):
5452
"""This fixture allows setting browser context arguments for Playwright.
5553
5654
Args:

tests/inventory_test.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66

77
class TestInventory:
8-
@pytest.mark.parametrize(
9-
"browser_context_args", [User.STANDARD_USER], indirect=True
10-
)
8+
@pytest.mark.parametrize("browser_context_args", [User.STANDARD_USER], indirect=True)
119
def test_inventory_page(self, browser_context_args, page: Page):
1210
expect(page.get_by_test_id("title")).to_have_text("Products")

tests/login_test.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ def test_valid_login(self, base_url, page: Page):
3434
ids=["invalid_password", "locked_user"],
3535
)
3636
@allure.title("Login with invalid credentials test")
37-
def test_login_error(
38-
self, page: Page, username: str, password: str, expected_error: str
39-
):
37+
def test_login_error(self, page: Page, username: str, password: str, expected_error: str):
4038
self.login_page.login(username, password)
4139
expect(self.login_page.error_message).to_have_text(expected_error)

utilities/axe_helper.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,12 @@ def check_accessibility(
3131
}
3232
results = self.axe.run(page)
3333
violations_count = dict(
34-
Counter(
35-
[violation["impact"] for violation in results.response["violations"]]
36-
)
34+
Counter([violation["impact"] for violation in results.response["violations"]])
3735
)
3836
if violations_exceeded := {
3937
impact_level: violation_count
4038
for impact_level, violation_count in violations_count.items()
41-
if violation_count
42-
> maximum_allowed_violations_by_impact.get(impact_level, 0)
39+
if violation_count > maximum_allowed_violations_by_impact.get(impact_level, 0)
4340
}:
4441
allure.attach(
4542
body=json.dumps(results.response["violations"], indent=4),

0 commit comments

Comments
 (0)