1- import asyncio
21from dataclasses import dataclass
32from datetime import date
43from time import perf_counter
54
5+ import anyio
66import pytest
77
88from htmy import Component , ComponentType , Context , Renderer , component , html
@@ -25,7 +25,7 @@ def sync_function_component(msg: str, ctx: Context) -> ComponentType:
2525
2626@component
2727async def async_function_component (msg : str , ctx : Context ) -> ComponentType :
28- await asyncio .sleep (async_delay )
28+ await anyio .sleep (async_delay )
2929 dt : date = ctx ["date" ]
3030 return html .p (dt .isoformat (), ": " , msg )
3131
@@ -41,7 +41,7 @@ def sync_function_component_with_function_alias(msg: str, ctx: Context) -> Compo
4141
4242@component .function
4343async def async_function_component_with_function_alias (msg : str , ctx : Context ) -> ComponentType :
44- await asyncio .sleep (async_delay )
44+ await anyio .sleep (async_delay )
4545 dt : date = ctx ["date" ]
4646 return html .p (dt .isoformat (), ": " , msg )
4747
@@ -57,7 +57,7 @@ def sync_context_only_function_component(ctx: Context) -> ComponentType:
5757
5858@component .context_only
5959async def async_context_only_function_component (ctx : Context ) -> ComponentType :
60- await asyncio .sleep (async_delay )
60+ await anyio .sleep (async_delay )
6161 dt : date = ctx ["date" ]
6262 return html .p (dt .isoformat (), ": " , message )
6363
@@ -76,7 +76,7 @@ def sync_method_component(self, msg: str, ctx: Context) -> ComponentType:
7676
7777 @component .method
7878 async def async_method_component (self , msg : str , ctx : Context ) -> ComponentType :
79- await asyncio .sleep (async_delay )
79+ await anyio .sleep (async_delay )
8080 dt : date = ctx ["date" ]
8181 return html .p (dt .isoformat (), ": " , msg , " " , self .goodbye )
8282
@@ -87,7 +87,7 @@ def sync_context_only_method_component(self, ctx: Context) -> ComponentType:
8787
8888 @component .context_only_method
8989 async def async_context_only_method_component (self , ctx : Context ) -> ComponentType :
90- await asyncio .sleep (async_delay )
90+ await anyio .sleep (async_delay )
9191 dt : date = ctx ["date" ]
9292 return html .p (dt .isoformat (), ": " , self .goodbye )
9393
@@ -110,7 +110,7 @@ def baseline_renderer() -> BaselineRenderer:
110110# -- Tests
111111
112112
113- @pytest .mark .asyncio
113+ @pytest .mark .anyio
114114@pytest .mark .parametrize (
115115 ("comp" , "expected" , "min_duration" ),
116116 (
0 commit comments