File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,6 @@ def deferred_from_coro(o):
73
73
return deferred_from_coro_default (windows_get_result (o ))
74
74
75
75
else :
76
- windows_get_result = None
77
76
deferred_from_coro = deferred_from_coro_default
78
77
79
78
Original file line number Diff line number Diff line change 1
1
import inspect
2
+ import platform
2
3
from contextlib import asynccontextmanager
4
+
3
5
import pytest
4
6
from scrapy import Request
5
7
from scrapy .http .response .html import HtmlResponse
6
8
from scrapy .utils .test import get_crawler
7
9
8
- from scrapy_playwright .handler import windows_get_result
9
-
10
10
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
14
13
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 ]):
17
17
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 ))
20
20
21
- return wrapper
21
+ return pytest_mark_asyncio (method_proxy )
22
+ return windows_pytest_mark_asyncio (pytest_mark_asyncio (* args , ** kwargs ))
22
23
24
+ return wrapper
23
25
24
- if windows_get_result :
25
26
pytest .mark .asyncio = windows_pytest_mark_asyncio (pytest .mark .asyncio )
26
27
27
28
You can’t perform that action at this time.
0 commit comments