-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconftest.py
78 lines (56 loc) · 1.46 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# pylint: disable=unused-argument,missing-function-docstring
# Stdlib:
import asyncio
from typing import Any
# Thirdparty:
import aiomultiprocess
import mock
import pytest
# Firstparty:
from wdb_server.app import init_app
# fixtures
@pytest.fixture
async def client(aiohttp_client):
"""
The fixture for the initialize client.
"""
app = await init_app({})
return await aiohttp_client(app)
class DummySocket:
"""
Test class for represent any real socket
"""
async def close(self):
...
async def write(self, data: Any):
...
class DummyWebSocket(DummySocket):
"""
Test class for represent any real websocket
"""
async def write_message(self, message: str):
...
@pytest.fixture
def dummy_socket():
return DummySocket()
@pytest.fixture
def dummy_websocket():
return DummyWebSocket()
@pytest.fixture()
def Process___init__(): # pylint: disable=invalid-name
with mock.patch.object(
aiomultiprocess.Process, "__init__", return_value=None
) as mock_method:
yield mock_method
@pytest.fixture()
def Process_start(): # pylint: disable=invalid-name
with mock.patch.object(
aiomultiprocess.Process, "start", return_value=None
) as mock_method:
yield mock_method
@pytest.fixture()
def create_subprocess_exec():
with mock.patch.object(
asyncio, "create_subprocess_exec", return_value=None
) as mock_method:
yield mock_method