Skip to content

Commit

Permalink
Black & typing adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
elacuesta committed Jun 14, 2024
1 parent 8a3cfb5 commit 84f7cd6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
1 change: 0 additions & 1 deletion scrapy_playwright/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def deferred_from_coro(o):
return deferred_from_coro_default(windows_get_result(o))

else:
windows_get_result = None
deferred_from_coro = deferred_from_coro_default


Expand Down
23 changes: 12 additions & 11 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
import inspect
import platform
from contextlib import asynccontextmanager

import pytest
from scrapy import Request
from scrapy.http.response.html import HtmlResponse
from scrapy.utils.test import get_crawler

from scrapy_playwright.handler import windows_get_result


def windows_pytest_mark_asyncio(pytest_mark_asyncio):
def wrapper(*args, **kwargs):
if args and inspect.iscoroutinefunction(args[0]):
if platform.system() == "Windows":
from scrapy_playwright.handler import windows_get_result

async def method_proxy(*x):
await windows_get_result(args[0](*x))
def windows_pytest_mark_asyncio(pytest_mark_asyncio):
def wrapper(*args, **kwargs):
if args and inspect.iscoroutinefunction(args[0]):

return pytest_mark_asyncio(method_proxy)
return windows_pytest_mark_asyncio(pytest_mark_asyncio(*args, **kwargs))
async def method_proxy(*x):
await windows_get_result(args[0](*x))

return wrapper
return pytest_mark_asyncio(method_proxy)
return windows_pytest_mark_asyncio(pytest_mark_asyncio(*args, **kwargs))

return wrapper

if windows_get_result:
pytest.mark.asyncio = windows_pytest_mark_asyncio(pytest.mark.asyncio)


Expand Down

0 comments on commit 84f7cd6

Please sign in to comment.