Tidy a typing-typo, add explicit `ids=` for paramed suites

ns_aware
Gud Boi 2026-03-09 19:35:47 -04:00
parent b71e8575e5
commit fb94aa0095
1 changed files with 18 additions and 13 deletions

View File

@ -6,23 +6,16 @@ msg patterns.
from __future__ import annotations from __future__ import annotations
from typing import ( from typing import (
Callable, Callable,
TYPE_CHECKING,
) )
import pytest import pytest
import trio import trio
import tractor import tractor
if TYPE_CHECKING:
from tractor import (
Portal,
)
@tractor.context @tractor.context
async def simple_rpc( async def simple_rpc(
ctx: tractor.Context, ctx: tractor.Context,
data: int, data: int,
) -> None: ) -> None:
''' '''
Test a small ping-pong server. Test a small ping-pong server.
@ -51,7 +44,6 @@ async def simple_rpc(
async def simple_rpc_with_forloop( async def simple_rpc_with_forloop(
ctx: tractor.Context, ctx: tractor.Context,
data: int, data: int,
) -> None: ) -> None:
''' '''
Same as previous test but using `async for` syntax/api. Same as previous test but using `async for` syntax/api.
@ -77,15 +69,25 @@ async def simple_rpc_with_forloop(
@pytest.mark.parametrize( @pytest.mark.parametrize(
'use_async_for', 'use_async_for',
[True, False], [
True,
False,
],
ids='use_async_for={}'.format,
) )
@pytest.mark.parametrize( @pytest.mark.parametrize(
'server_func', 'server_func',
[simple_rpc, simple_rpc_with_forloop], [
simple_rpc,
simple_rpc_with_forloop,
],
ids='server_func={}'.format,
) )
def test_simple_rpc( def test_simple_rpc(
server_func: Callabe, server_func: Callable,
use_async_for: bool, use_async_for: bool,
loglevel: str,
debug_mode: bool,
): ):
''' '''
The simplest request response pattern. The simplest request response pattern.
@ -93,8 +95,11 @@ def test_simple_rpc(
''' '''
async def main(): async def main():
with trio.fail_after(6): with trio.fail_after(6):
async with tractor.open_nursery() as an: async with tractor.open_nursery(
portal: Portal = await an.start_actor( loglevel=loglevel,
debug_mode=debug_mode,
) as an:
portal: tractor.Portal = await an.start_actor(
'rpc_server', 'rpc_server',
enable_modules=[__name__], enable_modules=[__name__],
) )