Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/monthly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@v8.2.0
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Install dependencies
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Set up Python
uses: actions/setup-python@v6
uses: actions/setup-python@v7
with:
python-version: "3.14"
- name: Set up uv
uses: astral-sh/setup-uv@v8.2.0
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Install dependencies
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
run: npx -y allure generate allure-results --output allure-report
- name: Allure PR summary
if: always()
uses: allure-framework/allure-action@v0.8.0
uses: allure-framework/allure-action@v0.9.0
with:
report-directory: "./allure-report"
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repos:
- id: no-commit-to-branch
args: ['--branch', 'main']
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.4
rev: 0.38.0
hooks:
- id: check-github-workflows
args: ["--verbose"]
Expand All @@ -29,21 +29,21 @@ repos:
stages: [commit-msg]
args: []
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
rev: v0.16.4
hooks:
- id: ruff
args: [ --fix ]
continue_on_error: true
- id: ruff-format
continue_on_error: true
- repo: https://github.com/codespell-project/codespell
rev: v2.4.2
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies:
- tomli
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.25
rev: 0.26
hooks:
- id: validate-pyproject
additional_dependencies: ["validate-pyproject-schema-store[all]"]
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[dependency-groups]
dev = [
"ruff==0.15.20",
"pre-commit==4.6.0",
"pytest-flakiness==1.1.0",
"ruff==0.16.4",
"pre-commit==4.6.2",
"pytest-flakiness==1.2.0",
]

[project]
Expand All @@ -17,19 +17,19 @@ dependencies = [
"assertpy==1.1",
"dataclasses-json==0.6.7",
"deprecated==1.3.1",
"mailinator-python-client-2==1.0.8",
"mysql-connector-python==9.7.0",
"mailinator-python-client-2==1.0.9",
"mysql-connector-python==26.7.0",
"pytest==9.1.1",
"pytest-base-url==2.1.0",
"pytest-check==2.8.0",
"pytest-check==2.9.1",
"pytest-dependency==0.6.1",
"pytest-ordering==0.6",
"pytest-rerunfailures==16.3",
"pytest-rerunfailures==16.6",
"pytest-split==0.11.0",
"python-dotenv==1.2.2",
"python-dotenv==1.2.3",
"requests==2.34.2",
"requests-toolbelt==1.0.0",
"selenium==4.45.0",
"selenium==4.47.0",
"tenacity==9.1.4",
"visual-regression-tracker==4.9.0",
"xlrd==2.0.2"
Expand Down
20 changes: 12 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
drivers = ("chrome", "firefox", "chrome_headless")
DEFAULT_WINDOW_WIDTH = 1920
DEFAULT_WINDOW_HEIGHT = 1080
CHROME_BROWSER_VERSION = "150.0.7871.114"


def pytest_addoption(parser: Parser) -> None:
Expand Down Expand Up @@ -139,6 +138,7 @@ def vrt_helper():

def pytest_runtest_setup(item: Item) -> None:
global browser, driver, chrome_options, wait, console_messages, javascript_errors
driver = None
browser = item.config.getoption("driver")
base_url = item.config.getoption("base_url")
if browser in ("chrome", "chrome_headless"):
Expand All @@ -161,7 +161,6 @@ def pytest_runtest_setup(item: Item) -> None:
},
)
chrome_options.enable_bidi = True
chrome_options.browser_version = CHROME_BROWSER_VERSION
chrome_options.add_argument("disable-dev-shm-usage")
chrome_options.add_argument("no-sandbox")
chrome_options.add_argument("allow-file-access-from-files")
Expand Down Expand Up @@ -227,8 +226,7 @@ def pytest_runtest_setup(item: Item) -> None:
def pytest_runtest_teardown() -> None:
"""Pytest hook for teardown after each test.

Checks if the 'driver' variable is present in the local or global namespace.
If found, it calls the 'quit()' method on the 'driver' object to close the browser.
Closes the active browser and clears its reference.

Note: This function assumes that the 'driver' variable is used for browser automation,
and its presence is necessary for cleanup.
Expand All @@ -237,8 +235,12 @@ def pytest_runtest_teardown() -> None:
None

"""
if "driver" in locals() or "driver" in globals():
driver.quit()
global driver
if driver is not None:
try:
driver.quit()
finally:
driver = None


def pytest_sessionstart() -> None:
Expand Down Expand Up @@ -266,8 +268,10 @@ def pytest_exception_interact(node: Item) -> None:
None

"""
session_request: requests.Session = node.funcargs["session_request"]
if "driver" not in locals() and "driver" not in globals():
if globals().get("driver") is None:
return
session_request: requests.Session | None = node.funcargs.get("session_request")
if session_request is None:
return
window_count = len(driver.window_handles)
with allure.step("public ip address"):
Expand Down
Loading