Skip to content

Commit d2d88a0

Browse files
committed
YAPF'd
1 parent a881a28 commit d2d88a0

11 files changed

Lines changed: 76 additions & 39 deletions

File tree

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def create_task(coro):
5656
async def loop():
5757
async with trio_asyncio.open_loop() as loop:
5858
try:
59-
await yield_( loop)
59+
await yield_(loop)
6060
finally:
6161
await loop.stop().wait()
6262

tests/interop/test_adapter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from async_generator import asynccontextmanager
1010
from .. import utils as test_utils
1111

12+
1213
class SomeThing:
1314
flag = 0
1415

@@ -97,6 +98,7 @@ async def ctx_trio(self):
9798
await trio.sleep(0.01)
9899
self.flag |= 2
99100

101+
100102
class TestAdapt(aiotest.TestCase):
101103
@pytest.mark.trio
102104
async def test_asyncio_trio_depr(self, loop):
@@ -207,6 +209,7 @@ async def run_asyncio_trio_ctx(self, loop):
207209
async def test_asyncio_trio_ctx(self, loop):
208210
await aio_as_trio(self.run_asyncio_trio_ctx)(loop)
209211

212+
210213
class TestAllow(aiotest.TestCase):
211214
async def run_asyncio_trio(self, loop):
212215
"""Call asyncio from trio"""
@@ -287,4 +290,3 @@ async def run_trio_asyncio_ctx(self, loop):
287290
@pytest.mark.trio
288291
async def test_trio_asyncio_ctx(self, loop):
289292
await allow_asyncio(self.run_trio_asyncio_ctx, loop)
290-

tests/interop/test_calls.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,9 @@ async def in_asyncio(started, seen):
441441
async def cancel_trio(seen):
442442
started = trio.Event()
443443
async with trio.open_nursery() as nursery:
444-
nursery.start_soon(partial(self.call_t_a_depr, loop=loop), in_asyncio, started, seen)
444+
nursery.start_soon(
445+
partial(self.call_t_a_depr, loop=loop), in_asyncio, started, seen
446+
)
445447
await started.wait()
446448
nursery.cancel_scope.cancel()
447449
seen.flag |= 8
@@ -583,6 +585,8 @@ async def slow_nums():
583585

584586
sum = 0
585587
# with test_utils.deprecate(self): ## not yet
586-
async for n in aio_as_trio(slow_nums(), loop=loop):
588+
async for n in aio_as_trio(
589+
slow_nums(), loop=loop
590+
):
587591
sum += n
588592
assert sum == 15

tests/python/test_events.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,8 +1836,7 @@ async def main():
18361836

18371837
if False and hasattr(selectors, 'KqueueSelector'):
18381838

1839-
class KqueueEventLoopTests(UnixEventLoopTestsMixin,
1840-
test_utils.TestCase):
1839+
class KqueueEventLoopTests(UnixEventLoopTestsMixin, test_utils.TestCase):
18411840
def create_event_loop(self):
18421841
return asyncio.SelectorEventLoop(selectors.KqueueSelector())
18431842

@@ -1858,15 +1857,13 @@ def test_write_pty(self):
18581857

18591858
if False and hasattr(selectors, 'EpollSelector'):
18601859

1861-
class EPollEventLoopTests(UnixEventLoopTestsMixin,
1862-
test_utils.TestCase):
1860+
class EPollEventLoopTests(UnixEventLoopTestsMixin, test_utils.TestCase):
18631861
def create_event_loop(self):
18641862
return asyncio.SelectorEventLoop(selectors.EpollSelector())
18651863

18661864
if False and hasattr(selectors, 'PollSelector'):
18671865

1868-
class PollEventLoopTests(UnixEventLoopTestsMixin,
1869-
test_utils.TestCase):
1866+
class PollEventLoopTests(UnixEventLoopTestsMixin, test_utils.TestCase):
18701867
def create_event_loop(self):
18711868
return asyncio.SelectorEventLoop(selectors.PollSelector())
18721869

tests/python/test_locks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
)
1717
RGX_REPR = re.compile(STR_RGX_REPR)
1818

19+
1920
class LockTests(test_utils.TestCase):
2021
def setUp(self):
2122
super().setUp()

tests/test_aio_subprocess.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
from . import utils as test_utils
1717

18+
1819
class MySubprocessProtocol(asyncio.SubprocessProtocol):
1920
def __init__(self, loop):
2021
self.state = 'INITIAL'
@@ -61,16 +62,20 @@ def check_terminated(returncode):
6162
else:
6263
assert -signal.SIGTERM == returncode
6364

65+
6466
def check_killed(returncode):
6567
if sys.platform == 'win32':
6668
assert isinstance(returncode, int)
6769
# expect 1 but sometimes get 0
6870
else:
6971
assert -signal.SIGKILL == returncode
7072

73+
7174
@pytest.mark.trio
7275
async def test_subprocess_exec(loop):
7376
await run_subprocess_exec(loop)
77+
78+
7479
@aio_as_trio
7580
async def run_subprocess_exec(loop):
7681
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo.py')
@@ -92,9 +97,12 @@ async def run_subprocess_exec(loop):
9297
check_killed(proto.returncode)
9398
assert b'Python The Winner' == proto.data[1]
9499

100+
95101
@pytest.mark.trio
96102
async def test_subprocess_interactive(loop):
97103
await run_subprocess_interactive(loop)
104+
105+
98106
@aio_as_trio
99107
async def run_subprocess_interactive(loop):
100108
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo.py')
@@ -122,14 +130,15 @@ async def run_subprocess_interactive(loop):
122130
await proto.completed
123131
check_killed(proto.returncode)
124132

133+
125134
@pytest.mark.trio
126135
async def test_subprocess_shell(loop):
127136
await run_subprocess_shell(loop)
137+
138+
128139
@aio_as_trio
129140
async def run_subprocess_shell(loop):
130-
connect = loop.subprocess_shell(
131-
functools.partial(MySubprocessProtocol, loop), 'echo Python'
132-
)
141+
connect = loop.subprocess_shell(functools.partial(MySubprocessProtocol, loop), 'echo Python')
133142
transp, proto = await connect
134143
assert isinstance(proto, MySubprocessProtocol)
135144
await proto.connected
@@ -142,9 +151,12 @@ async def run_subprocess_shell(loop):
142151
assert proto.data[2] == b''
143152
transp.close()
144153

154+
145155
@pytest.mark.trio
146156
async def test_subprocess_exitcode(loop):
147157
await run_subprocess_exitcode(loop)
158+
159+
148160
@aio_as_trio
149161
async def run_subprocess_exitcode(loop):
150162
connect = loop.subprocess_shell(
@@ -160,9 +172,12 @@ async def run_subprocess_exitcode(loop):
160172
assert 7 == proto.returncode
161173
transp.close()
162174

175+
163176
@pytest.mark.trio
164177
async def test_subprocess_close_after_finish(loop):
165178
await run_subprocess_close_after_finish(loop)
179+
180+
166181
@aio_as_trio
167182
async def run_subprocess_close_after_finish(loop):
168183
connect = loop.subprocess_shell(
@@ -181,9 +196,12 @@ async def run_subprocess_close_after_finish(loop):
181196
assert 7 == proto.returncode
182197
assert transp.close() is None
183198

199+
184200
@pytest.mark.trio
185201
async def test_subprocess_kill(loop):
186202
await run_subprocess_kill(loop)
203+
204+
187205
@aio_as_trio
188206
async def run_subprocess_kill(loop):
189207
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo.py')
@@ -200,9 +218,12 @@ async def run_subprocess_kill(loop):
200218
check_killed(proto.returncode)
201219
transp.close()
202220

221+
203222
@pytest.mark.trio
204223
async def test_subprocess_terminate(loop):
205224
await run_subprocess_terminate(loop)
225+
226+
206227
@aio_as_trio
207228
async def run_subprocess_terminate(loop):
208229
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo.py')
@@ -219,10 +240,13 @@ async def run_subprocess_terminate(loop):
219240
check_terminated(proto.returncode)
220241
transp.close()
221242

243+
222244
@unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
223245
@pytest.mark.trio
224246
async def test_subprocess_send_signal(loop):
225247
await run_subprocess_send_signal(loop)
248+
249+
226250
@aio_as_trio
227251
async def run_subprocess_send_signal(loop):
228252
# bpo-31034: Make sure that we get the default signal handler (killing
@@ -246,9 +270,12 @@ async def run_subprocess_send_signal(loop):
246270
finally:
247271
signal.signal(signal.SIGHUP, old_handler)
248272

273+
249274
@pytest.mark.trio
250275
async def test_subprocess_stderr(loop):
251276
await run_subprocess_stderr(loop)
277+
278+
252279
@aio_as_trio
253280
async def run_subprocess_stderr(loop):
254281
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo2.py')
@@ -270,9 +297,12 @@ async def run_subprocess_stderr(loop):
270297
assert proto.data[2].startswith(b'ERR:test'), proto.data[2]
271298
assert 0 == proto.returncode
272299

300+
273301
@pytest.mark.trio
274302
async def test_subprocess_stderr_redirect_to_stdout(loop):
275303
await run_subprocess_stderr_redirect_to_stdout(loop)
304+
305+
276306
@aio_as_trio
277307
async def run_subprocess_stderr_redirect_to_stdout(loop):
278308
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo2.py')
@@ -299,9 +329,12 @@ async def run_subprocess_stderr_redirect_to_stdout(loop):
299329
transp.close()
300330
assert 0 == proto.returncode
301331

332+
302333
@pytest.mark.trio
303334
async def test_subprocess_close_client_stream(loop):
304335
await run_subprocess_close_client_stream(loop)
336+
337+
305338
@aio_as_trio
306339
async def run_subprocess_close_client_stream(loop):
307340
prog = os.path.join(os.path.dirname(__file__), 'scripts', 'echo3.py')
@@ -336,9 +369,12 @@ async def run_subprocess_close_client_stream(loop):
336369
await proto.completed
337370
check_killed(proto.returncode)
338371

372+
339373
@pytest.mark.trio
340374
async def test_subprocess_wait_no_same_group(loop):
341375
await run_subprocess_wait_no_same_group(loop)
376+
377+
342378
@aio_as_trio
343379
async def run_subprocess_wait_no_same_group(loop):
344380
# start the new process in a new session
@@ -355,6 +391,7 @@ async def run_subprocess_wait_no_same_group(loop):
355391
await proto.completed
356392
assert 7 == proto.returncode
357393

394+
358395
@pytest.mark.trio
359396
async def test_subprocess_exec_invalid_args(loop):
360397
@aio_as_trio
@@ -368,6 +405,7 @@ async def connect(**kwds):
368405
with pytest.raises(ValueError):
369406
await connect(shell=True)
370407

408+
371409
@pytest.mark.trio
372410
async def test_subprocess_shell_invalid_args(loop):
373411
@aio_as_trio
@@ -384,5 +422,3 @@ async def connect(cmd=None, **kwds):
384422
await connect(bufsize=4096)
385423
with pytest.raises(ValueError):
386424
await connect(shell=False)
387-
388-

tests/utils.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,6 @@ def get_function_source(func):
583583
return source
584584

585585

586-
587586
def deprecate(tc, vers=None):
588587
if vers is None or sys.version_info >= vers:
589588
return pytest.deprecated_call()
@@ -599,5 +598,3 @@ def __exit__(self, *tb):
599598
pass
600599

601600
return _deprecate(tc)
602-
603-

0 commit comments

Comments
 (0)