Skip to content

Commit 84f7cd6

Browse files
committed
Black & typing adjustments
1 parent 8a3cfb5 commit 84f7cd6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

scrapy_playwright/handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ def deferred_from_coro(o):
7373
return deferred_from_coro_default(windows_get_result(o))
7474

7575
else:
76-
windows_get_result = None
7776
deferred_from_coro = deferred_from_coro_default
7877

7978

tests/__init__.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
import inspect
2+
import platform
23
from contextlib import asynccontextmanager
4+
35
import pytest
46
from scrapy import Request
57
from scrapy.http.response.html import HtmlResponse
68
from scrapy.utils.test import get_crawler
79

8-
from scrapy_playwright.handler import windows_get_result
9-
1010

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

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

18-
return pytest_mark_asyncio(method_proxy)
19-
return windows_pytest_mark_asyncio(pytest_mark_asyncio(*args, **kwargs))
18+
async def method_proxy(*x):
19+
await windows_get_result(args[0](*x))
2020

21-
return wrapper
21+
return pytest_mark_asyncio(method_proxy)
22+
return windows_pytest_mark_asyncio(pytest_mark_asyncio(*args, **kwargs))
2223

24+
return wrapper
2325

24-
if windows_get_result:
2526
pytest.mark.asyncio = windows_pytest_mark_asyncio(pytest.mark.asyncio)
2627

2728

0 commit comments

Comments
 (0)