Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 7, 2024
1 parent d8b9d1a commit bc14c02
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
15 changes: 5 additions & 10 deletions pytest_pyodide/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,17 @@ class SeleniumType(Protocol):
JavascriptException: type
browser: str

def load_package(self, pkgs: str | list[str]):
...
def load_package(self, pkgs: str | list[str]): ...

def run_async(self, code: str):
...
def run_async(self, code: str): ...

def run_js(self, code: str):
...
def run_js(self, code: str): ...


class _ReadableFileobj(Protocol):
def read(self, __n: int) -> bytes:
...
def read(self, __n: int) -> bytes: ...

def readline(self) -> bytes:
...
def readline(self) -> bytes: ...


class Unpickler(pickle.Unpickler):
Expand Down
20 changes: 12 additions & 8 deletions pytest_pyodide/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ def selenium_context_manager(selenium_module_scope):

@pytest.fixture
def selenium(request, selenium_module_scope):
with selenium_context_manager(
selenium_module_scope
) as selenium, set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
with (

Check warning on line 277 in pytest_pyodide/fixture.py

View check run for this annotation

Codecov / codecov/patch

pytest_pyodide/fixture.py#L277

Added line #L277 was not covered by tests
selenium_context_manager(selenium_module_scope) as selenium,
set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
),
):
yield selenium

Expand All @@ -294,10 +295,13 @@ def selenium_jspi_inner(request, runtime, web_server_main, playwright_browsers):
pytest.skip(f"jspi not supported in {runtime}")
if request.config.option.runner.lower() == "playwright":
pytest.skip("jspi not supported with playwright")
with selenium_common(
request, runtime, web_server_main, browsers=playwright_browsers, jspi=True
) as selenium, set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
with (

Check warning on line 298 in pytest_pyodide/fixture.py

View check run for this annotation

Codecov / codecov/patch

pytest_pyodide/fixture.py#L298

Added line #L298 was not covered by tests
selenium_common(
request, runtime, web_server_main, browsers=playwright_browsers, jspi=True
) as selenium,
set_webdriver_script_timeout(
selenium, script_timeout=parse_driver_timeout(request.node)
),
):
yield selenium

Expand Down
11 changes: 4 additions & 7 deletions pytest_pyodide/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,14 +596,11 @@ def clean_logs(self):

def run_js_inner(self, code, check_code):
check_code = ""
wrapped = """
let result = await (async () => {{ {} }})();
{}
wrapped = f"""

Check warning on line 599 in pytest_pyodide/runner.py

View check run for this annotation

Codecov / codecov/patch

pytest_pyodide/runner.py#L599

Added line #L599 was not covered by tests
let result = await (async () => {{ {code} }})();
{check_code}
return result;
""".format(
code,
check_code,
)
"""
from uuid import uuid4

cmd_id = str(uuid4())
Expand Down
1 change: 0 additions & 1 deletion tests/test_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ def assert_get_handle(selenium, d, key, value):
@run_in_pyodide
def returns_handle(selenium):
import __main__

from pytest_pyodide.decorator import PyodideHandle

o = {"a": 6}
Expand Down

0 comments on commit bc14c02

Please sign in to comment.