Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] authored Oct 8, 2024
1 parent 61e4c3c commit a098295
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ default_language_version:
python: "3.10"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.4.0"
rev: "v5.0.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
Expand All @@ -15,19 +15,19 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.254"
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.6.9"
hooks:
- id: ruff
args: [--fix]

- repo: https://github.com/psf/black
rev: "23.1.0"
rev: "24.10.0"
hooks:
- id: black

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.1.1"
rev: "v1.11.2"
hooks:
- id: mypy
exclude: (setup.py|^tests|conftest.py)
Expand All @@ -41,12 +41,12 @@ repos:
- pytest

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.2"
rev: "v0.10.0.1"
hooks:
- id: shellcheck

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.4"
rev: "v2.3.0"
hooks:
- id: codespell
args: ["-L", "te,slowy,aray,ba,nd,classs,crate,feld,lits"]
Expand Down
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 (
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 (
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"""
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 a098295

Please sign in to comment.