@@ -183,12 +183,15 @@ async def test_workflow_payload_conversion(
183183 workflow_id = str (uuid .uuid4 ())
184184 task_queue = str (uuid .uuid4 ())
185185
186- config = client .config ()
187- config ["data_converter" ] = dataclasses .replace (
188- DataConverter .default ,
189- payload_converter_class = SerializationContextCompositePayloadConverter ,
186+ client = Client (
187+ ** {
188+ ** client .config (),
189+ "data_converter" : dataclasses .replace (
190+ DataConverter .default ,
191+ payload_converter_class = SerializationContextCompositePayloadConverter ,
192+ ),
193+ }
190194 )
191- client = Client (** config )
192195
193196 async with Worker (
194197 client ,
@@ -321,14 +324,16 @@ async def test_heartbeat_details_payload_conversion(client: Client):
321324 workflow_id = str (uuid .uuid4 ())
322325 task_queue = str (uuid .uuid4 ())
323326
324- config = client .config ()
325- config ["data_converter" ] = dataclasses .replace (
326- DataConverter .default ,
327- payload_converter_class = SerializationContextCompositePayloadConverter ,
327+ client = Client (
328+ ** {
329+ ** client .config (),
330+ "data_converter" : dataclasses .replace (
331+ DataConverter .default ,
332+ payload_converter_class = SerializationContextCompositePayloadConverter ,
333+ ),
334+ }
328335 )
329336
330- client = Client (** config )
331-
332337 async with Worker (
333338 client ,
334339 task_queue = task_queue ,
@@ -387,12 +392,15 @@ async def test_local_activity_payload_conversion(client: Client):
387392 workflow_id = str (uuid .uuid4 ())
388393 task_queue = str (uuid .uuid4 ())
389394
390- config = client .config ()
391- config ["data_converter" ] = dataclasses .replace (
392- DataConverter .default ,
393- payload_converter_class = SerializationContextCompositePayloadConverter ,
395+ client = Client (
396+ ** {
397+ ** client .config (),
398+ "data_converter" : dataclasses .replace (
399+ DataConverter .default ,
400+ payload_converter_class = SerializationContextCompositePayloadConverter ,
401+ ),
402+ }
394403 )
395- client = Client (** config )
396404
397405 async with Worker (
398406 client ,
@@ -488,14 +496,16 @@ async def test_async_activity_completion_payload_conversion(
488496 workflow_id = str (uuid .uuid4 ())
489497 task_queue = str (uuid .uuid4 ())
490498
491- config = client .config ()
492- config ["data_converter" ] = dataclasses .replace (
493- DataConverter .default ,
494- payload_converter_class = SerializationContextCompositePayloadConverter ,
499+ client = Client (
500+ ** {
501+ ** client .config (),
502+ "data_converter" : dataclasses .replace (
503+ DataConverter .default ,
504+ payload_converter_class = SerializationContextCompositePayloadConverter ,
505+ ),
506+ }
495507 )
496508
497- client = Client (** config )
498-
499509 async with Worker (
500510 client ,
501511 task_queue = task_queue ,
@@ -554,22 +564,24 @@ async def test_signal_payload_conversion(
554564 workflow_id = str (uuid .uuid4 ())
555565 task_queue = str (uuid .uuid4 ())
556566
557- config = client .config ()
558- config ["data_converter" ] = dataclasses .replace (
559- DataConverter .default ,
560- payload_converter_class = SerializationContextCompositePayloadConverter ,
567+ client = Client (
568+ ** {
569+ ** client .config (),
570+ "data_converter" : dataclasses .replace (
571+ DataConverter .default ,
572+ payload_converter_class = SerializationContextCompositePayloadConverter ,
573+ ),
574+ }
561575 )
562576
563- custom_client = Client (** config )
564-
565577 async with Worker (
566- custom_client ,
578+ client ,
567579 task_queue = task_queue ,
568580 workflows = [SignalSerializationContextTestWorkflow ],
569581 activities = [],
570582 workflow_runner = UnsandboxedWorkflowRunner (), # so that we can use isinstance
571583 ):
572- handle = await custom_client .start_workflow (
584+ handle = await client .start_workflow (
573585 SignalSerializationContextTestWorkflow .run ,
574586 id = workflow_id ,
575587 task_queue = task_queue ,
@@ -626,21 +638,24 @@ async def test_query_payload_conversion(
626638 workflow_id = str (uuid .uuid4 ())
627639 task_queue = str (uuid .uuid4 ())
628640
629- config = client .config ()
630- config ["data_converter" ] = dataclasses .replace (
631- DataConverter .default ,
632- payload_converter_class = SerializationContextCompositePayloadConverter ,
641+ client = Client (
642+ ** {
643+ ** client .config (),
644+ "data_converter" : dataclasses .replace (
645+ DataConverter .default ,
646+ payload_converter_class = SerializationContextCompositePayloadConverter ,
647+ ),
648+ }
633649 )
634- custom_client = Client (** config )
635650
636651 async with Worker (
637- custom_client ,
652+ client ,
638653 task_queue = task_queue ,
639654 workflows = [QuerySerializationContextTestWorkflow ],
640655 activities = [],
641656 workflow_runner = UnsandboxedWorkflowRunner (), # so that we can use isinstance
642657 ):
643- handle = await custom_client .start_workflow (
658+ handle = await client .start_workflow (
644659 QuerySerializationContextTestWorkflow .run ,
645660 id = workflow_id ,
646661 task_queue = task_queue ,
@@ -710,21 +725,24 @@ async def test_update_payload_conversion(
710725 workflow_id = str (uuid .uuid4 ())
711726 task_queue = str (uuid .uuid4 ())
712727
713- config = client .config ()
714- config ["data_converter" ] = dataclasses .replace (
715- DataConverter .default ,
716- payload_converter_class = SerializationContextCompositePayloadConverter ,
728+ client = Client (
729+ ** {
730+ ** client .config (),
731+ "data_converter" : dataclasses .replace (
732+ DataConverter .default ,
733+ payload_converter_class = SerializationContextCompositePayloadConverter ,
734+ ),
735+ }
717736 )
718- custom_client = Client (** config )
719737
720738 async with Worker (
721- custom_client ,
739+ client ,
722740 task_queue = task_queue ,
723741 workflows = [UpdateSerializationContextTestWorkflow ],
724742 activities = [],
725743 workflow_runner = UnsandboxedWorkflowRunner (), # so that we can use isinstance
726744 ):
727- wf_handle = await custom_client .start_workflow (
745+ wf_handle = await client .start_workflow (
728746 UpdateSerializationContextTestWorkflow .run ,
729747 pass_validation ,
730748 id = workflow_id ,
@@ -818,12 +836,15 @@ async def test_external_workflow_signal_and_cancel_payload_conversion(
818836 signaler_workflow_id = str (uuid .uuid4 ())
819837 task_queue = str (uuid .uuid4 ())
820838
821- config = client .config ()
822- config ["data_converter" ] = dataclasses .replace (
823- DataConverter .default ,
824- payload_converter_class = SerializationContextCompositePayloadConverter ,
839+ client = Client (
840+ ** {
841+ ** client .config (),
842+ "data_converter" : dataclasses .replace (
843+ DataConverter .default ,
844+ payload_converter_class = SerializationContextCompositePayloadConverter ,
845+ ),
846+ }
825847 )
826- client = Client (** config )
827848
828849 async with Worker (
829850 client ,
@@ -967,9 +988,12 @@ async def test_failure_converter_with_context(client: Client):
967988 DataConverter .default ,
968989 failure_converter_class = FailureConverterWithContext ,
969990 )
970- config = client .config ()
971- config ["data_converter" ] = data_converter
972- client = Client (** config )
991+ client = Client (
992+ ** {
993+ ** client .config (),
994+ "data_converter" : data_converter ,
995+ }
996+ )
973997
974998 async with Worker (
975999 client ,
@@ -1107,11 +1131,15 @@ async def test_codec_with_context(client: Client):
11071131 workflow_id = str (uuid .uuid4 ())
11081132 task_queue = str (uuid .uuid4 ())
11091133
1110- client_config = client .config ()
1111- client_config ["data_converter" ] = dataclasses .replace (
1112- DataConverter .default , payload_codec = PayloadCodecWithContext ()
1134+ client = Client (
1135+ ** {
1136+ ** client .config (),
1137+ "data_converter" : dataclasses .replace (
1138+ DataConverter .default , payload_codec = PayloadCodecWithContext ()
1139+ ),
1140+ }
11131141 )
1114- client = Client ( ** client_config )
1142+
11151143 async with Worker (
11161144 client ,
11171145 task_queue = task_queue ,
@@ -1171,11 +1199,14 @@ async def test_local_activity_codec_with_context(client: Client):
11711199 workflow_id = str (uuid .uuid4 ())
11721200 task_queue = str (uuid .uuid4 ())
11731201
1174- client_config = client .config ()
1175- client_config ["data_converter" ] = dataclasses .replace (
1176- DataConverter .default , payload_codec = PayloadCodecWithContext ()
1202+ client = Client (
1203+ ** {
1204+ ** client .config (),
1205+ "data_converter" : dataclasses .replace (
1206+ DataConverter .default , payload_codec = PayloadCodecWithContext ()
1207+ ),
1208+ }
11771209 )
1178- client = Client (** client_config )
11791210 async with Worker (
11801211 client ,
11811212 task_queue = task_queue ,
@@ -1261,12 +1292,15 @@ async def test_child_workflow_codec_with_context(client: Client):
12611292 workflow_id = str (uuid .uuid4 ())
12621293 task_queue = str (uuid .uuid4 ())
12631294
1264- config = client .config ()
1265- config ["data_converter" ] = dataclasses .replace (
1266- DataConverter .default ,
1267- payload_codec = PayloadCodecWithContext (),
1295+ client = Client (
1296+ ** {
1297+ ** client .config (),
1298+ "data_converter" : dataclasses .replace (
1299+ DataConverter .default ,
1300+ payload_codec = PayloadCodecWithContext (),
1301+ ),
1302+ }
12681303 )
1269- client = Client (** config )
12701304
12711305 async with Worker (
12721306 client ,
@@ -1479,12 +1513,15 @@ async def test_payload_encryption_with_context(
14791513 workflow_id = str (uuid .uuid4 ())
14801514 task_queue = str (uuid .uuid4 ())
14811515
1482- config = client .config ()
1483- config ["data_converter" ] = dataclasses .replace (
1484- DataConverter .default ,
1485- payload_codec = PayloadEncryptionCodec (),
1516+ client = Client (
1517+ ** {
1518+ ** client .config (),
1519+ "data_converter" : dataclasses .replace (
1520+ DataConverter .default ,
1521+ payload_codec = PayloadEncryptionCodec (),
1522+ ),
1523+ }
14861524 )
1487- client = Client (** config )
14881525
14891526 async with Worker (
14901527 client ,
@@ -1561,13 +1598,15 @@ async def test_nexus_payload_codec_operations_lack_context(
15611598 """
15621599 encode() and decode() on nexus payloads should not have any context set.
15631600 """
1564- config = client .config ()
1565- config ["data_converter" ] = dataclasses .replace (
1566- DataConverter .default ,
1567- payload_codec = AssertNexusLacksContextPayloadCodec (),
1601+ client = Client (
1602+ ** {
1603+ ** client .config (),
1604+ "data_converter" : dataclasses .replace (
1605+ DataConverter .default ,
1606+ payload_codec = AssertNexusLacksContextPayloadCodec (),
1607+ ),
1608+ }
15681609 )
1569- client = Client (** config )
1570-
15711610 async with Worker (
15721611 client ,
15731612 task_queue = str (uuid .uuid4 ()),
@@ -1636,12 +1675,15 @@ async def test_pydantic_converter_with_context(client: Client):
16361675 wf_id = str (uuid .uuid4 ())
16371676 task_queue = str (uuid .uuid4 ())
16381677
1639- client_config = client .config ()
1640- client_config ["data_converter" ] = dataclasses .replace (
1641- DataConverter .default ,
1642- payload_converter_class = PydanticConverterWithContext ,
1678+ client = Client (
1679+ ** {
1680+ ** client .config (),
1681+ "data_converter" : dataclasses .replace (
1682+ DataConverter .default ,
1683+ payload_converter_class = PydanticConverterWithContext ,
1684+ ),
1685+ }
16431686 )
1644- client = Client (** client_config )
16451687
16461688 async with Worker (
16471689 client ,
0 commit comments