Skip to content

Commit

Permalink
fix ruff linting
Browse files Browse the repository at this point in the history
  • Loading branch information
dmy.berezovskyi committed Oct 14, 2024
1 parent d4620ff commit cfb205e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .ruff.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ruff Configuration
line-length = 85
line-length = 88
indent-width = 4
output-format = "grouped"
respect-gitignore = true
Expand Down
20 changes: 8 additions & 12 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@


def pytest_addoption(parser):
parser.addoption(
"--env", action="store", default="dev", help="Default environment"
)
parser.addoption("--env", action="store", default="dev", help="Default environment")
parser.addoption(
"--browser-type",
action="store",
Expand Down Expand Up @@ -89,8 +87,10 @@ def page(browser, request):
navigation_timeout = request.config.getoption("--navigation-timeout", default=12000)
default_timeout = request.config.getoption("--default-timeout", default=6000)

log.annotate(f"Creating a new browser context with timeouts: "
f"{navigation_timeout}, {default_timeout}")
log.annotate(
f"Creating a new browser context with timeouts: "
f"{navigation_timeout}, {default_timeout}"
)

# Create a new browser context
browser_context = browser.new_context(no_viewport=True)
Expand All @@ -105,7 +105,7 @@ def page(browser, request):
yield page

page.close()
browser_context.close() # Optional: Close the context if you want to free resources
# browser_context.close() # Optional: Close the context if you want to free resources # noqa


@pytest.hookimpl(hookwrapper=True)
Expand Down Expand Up @@ -134,9 +134,7 @@ def pytest_runtest_makereport(item):
screenshot_base64 = base64.b64encode(screenshot_bytes).decode()
# Embed screenshot in the HTML report
extra = getattr(report, "extra", [])
extra.append(
pytest_html.extras.image(screenshot_base64, "Screenshot")
)
extra.append(pytest_html.extras.image(screenshot_base64, "Screenshot"))
report.extra = extra
except Exception as e:
print(f"Error capturing screenshot: {e}")
Expand All @@ -149,9 +147,7 @@ def get_browser_options(request):
return {
"headless": request.config.getoption("--headless"),
"devtools": request.config.getoption("--devtools"),
"slow_mo": float(
request.config.getoption("--slow-mo")
), # Include slow_mo here
"slow_mo": float(request.config.getoption("--slow-mo")),
"proxy": {"server": request.config.getoption("--proxy")}
if request.config.getoption("--proxy")
else None,
Expand Down

0 comments on commit cfb205e

Please sign in to comment.