@@ -23,17 +23,17 @@ class TestTransportSerial:
23
23
24
24
async def test_init (self ):
25
25
"""Test null modem init."""
26
- SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
26
+ SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
27
27
28
28
async def test_loop (self ):
29
29
"""Test asyncio abstract methods."""
30
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
30
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
31
31
assert comm .loop
32
32
33
33
@pytest .mark .parametrize ("inx" , range (0 , 11 ))
34
34
async def test_abstract_methods (self , inx ):
35
35
"""Test asyncio abstract methods."""
36
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
36
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
37
37
methods = [
38
38
partial (comm .get_protocol ),
39
39
partial (comm .set_protocol , None ),
@@ -52,7 +52,7 @@ async def test_abstract_methods(self, inx):
52
52
@pytest .mark .parametrize ("inx" , range (0 , 4 ))
53
53
async def test_external_methods (self , inx ):
54
54
"""Test external methods."""
55
- comm = SerialTransport (mock .MagicMock (), mock .Mock (), "dummy" , None , None , None , None , None )
55
+ comm = SerialTransport (mock .MagicMock (), mock .Mock (), "dummy" , None , None , None , None , None , None )
56
56
comm .sync_serial .read = mock .MagicMock (return_value = "abcd" )
57
57
comm .sync_serial .write = mock .MagicMock (return_value = 4 )
58
58
comm .sync_serial .fileno = mock .MagicMock (return_value = 2 )
@@ -108,14 +108,14 @@ async def test_write_force_poll(self):
108
108
109
109
async def test_close (self ):
110
110
"""Test close."""
111
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
111
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
112
112
comm .sync_serial = None
113
113
comm .close ()
114
114
115
115
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
116
116
async def test_polling (self ):
117
117
"""Test polling."""
118
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
118
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
119
119
comm .sync_serial = mock .MagicMock ()
120
120
comm .sync_serial .read .side_effect = asyncio .CancelledError ("test" )
121
121
with contextlib .suppress (asyncio .CancelledError ):
@@ -124,15 +124,15 @@ async def test_polling(self):
124
124
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
125
125
async def test_poll_task (self ):
126
126
"""Test polling."""
127
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
127
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
128
128
comm .sync_serial = mock .MagicMock ()
129
129
comm .sync_serial .read .side_effect = serial .SerialException ("test" )
130
130
await comm .polling_task ()
131
131
132
132
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
133
133
async def test_poll_task2 (self ):
134
134
"""Test polling."""
135
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
135
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
136
136
comm .sync_serial = mock .MagicMock ()
137
137
comm .sync_serial = mock .MagicMock ()
138
138
comm .sync_serial .write .return_value = 4
@@ -144,7 +144,7 @@ async def test_poll_task2(self):
144
144
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
145
145
async def test_write_exception (self ):
146
146
"""Test write exception."""
147
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
147
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
148
148
comm .sync_serial = mock .MagicMock ()
149
149
comm .sync_serial .write .side_effect = BlockingIOError ("test" )
150
150
comm .intern_write_ready ()
@@ -154,7 +154,7 @@ async def test_write_exception(self):
154
154
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
155
155
async def test_write_ok (self ):
156
156
"""Test write exception."""
157
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
157
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
158
158
comm .sync_serial = mock .MagicMock ()
159
159
comm .sync_serial .write .return_value = 4
160
160
comm .intern_write_buffer .append (b"abcd" )
@@ -163,7 +163,7 @@ async def test_write_ok(self):
163
163
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
164
164
async def test_write_len (self ):
165
165
"""Test write exception."""
166
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
166
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
167
167
comm .sync_serial = mock .MagicMock ()
168
168
comm .sync_serial .write .return_value = 3
169
169
comm .async_loop .add_writer = mock .Mock ()
@@ -173,7 +173,7 @@ async def test_write_len(self):
173
173
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
174
174
async def test_write_force (self ):
175
175
"""Test write exception."""
176
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
176
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
177
177
comm .poll_task = True
178
178
comm .sync_serial = mock .MagicMock ()
179
179
comm .sync_serial .write .return_value = 3
@@ -183,7 +183,7 @@ async def test_write_force(self):
183
183
@pytest .mark .skipif (os .name == "nt" , reason = "Windows not supported" )
184
184
async def test_read_ready (self ):
185
185
"""Test polling."""
186
- comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
186
+ comm = SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
187
187
comm .sync_serial = mock .MagicMock ()
188
188
comm .intern_protocol = mock .Mock ()
189
189
comm .sync_serial .read = mock .Mock ()
@@ -199,4 +199,4 @@ async def test_import_pyserial(self):
199
199
with mock .patch .dict (sys .modules , {'no_modules' : None }) as mock_modules :
200
200
del mock_modules ['serial' ]
201
201
with pytest .raises (RuntimeError ):
202
- SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None )
202
+ SerialTransport (asyncio .get_running_loop (), mock .Mock (), "dummy" , None , None , None , None , None , None )
0 commit comments