forked from goodboy/tractor
				
			Drop run and rpc_module_paths from pubsub tests
							parent
							
								
									b46e60ab9d
								
							
						
					
					
						commit
						1eedd463cb
					
				| 
						 | 
					@ -46,8 +46,9 @@ async def pubber(get_topics, seed=10):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async def subs(
 | 
					async def subs(
 | 
				
			||||||
    which, pub_actor_name, seed=10,
 | 
					    which,
 | 
				
			||||||
    portal=None,
 | 
					    pub_actor_name,
 | 
				
			||||||
 | 
					    seed=10,
 | 
				
			||||||
    task_status=trio.TASK_STATUS_IGNORED,
 | 
					    task_status=trio.TASK_STATUS_IGNORED,
 | 
				
			||||||
):
 | 
					):
 | 
				
			||||||
    if len(which) == 1:
 | 
					    if len(which) == 1:
 | 
				
			||||||
| 
						 | 
					@ -61,7 +62,9 @@ async def subs(
 | 
				
			||||||
            return isinstance(i, int)
 | 
					            return isinstance(i, int)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # TODO: https://github.com/goodboy/tractor/issues/207
 | 
					    # TODO: https://github.com/goodboy/tractor/issues/207
 | 
				
			||||||
    async with tractor.find_actor(pub_actor_name) as portal:
 | 
					    async with tractor.wait_for_actor(pub_actor_name) as portal:
 | 
				
			||||||
 | 
					        assert portal
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async with portal.open_stream_from(
 | 
					        async with portal.open_stream_from(
 | 
				
			||||||
            pubber,
 | 
					            pubber,
 | 
				
			||||||
            topics=which,
 | 
					            topics=which,
 | 
				
			||||||
| 
						 | 
					@ -164,7 +167,11 @@ def test_multi_actor_subs_arbiter_pub(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async def main():
 | 
					    async def main():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async with tractor.open_nursery() as n:
 | 
					        async with tractor.open_nursery(
 | 
				
			||||||
 | 
					            arbiter_addr=arb_addr,
 | 
				
			||||||
 | 
					            enable_modules=[__name__],
 | 
				
			||||||
 | 
					            debug_mode=True,
 | 
				
			||||||
 | 
					        ) as n:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            name = 'root'
 | 
					            name = 'root'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -172,7 +179,7 @@ def test_multi_actor_subs_arbiter_pub(
 | 
				
			||||||
                # start the publisher as a daemon
 | 
					                # start the publisher as a daemon
 | 
				
			||||||
                master_portal = await n.start_actor(
 | 
					                master_portal = await n.start_actor(
 | 
				
			||||||
                    'streamer',
 | 
					                    'streamer',
 | 
				
			||||||
                    rpc_module_paths=[__name__],
 | 
					                    enable_modules=[__name__],
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            even_portal = await n.run_in_actor(
 | 
					            even_portal = await n.run_in_actor(
 | 
				
			||||||
| 
						 | 
					@ -242,11 +249,7 @@ def test_multi_actor_subs_arbiter_pub(
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                await master_portal.cancel_actor()
 | 
					                await master_portal.cancel_actor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tractor.run(
 | 
					    trio.run(main)
 | 
				
			||||||
        main,
 | 
					 | 
				
			||||||
        arbiter_addr=arb_addr,
 | 
					 | 
				
			||||||
        rpc_module_paths=[__name__],
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def test_single_subactor_pub_multitask_subs(
 | 
					def test_single_subactor_pub_multitask_subs(
 | 
				
			||||||
| 
						 | 
					@ -255,11 +258,14 @@ def test_single_subactor_pub_multitask_subs(
 | 
				
			||||||
):
 | 
					):
 | 
				
			||||||
    async def main():
 | 
					    async def main():
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        async with tractor.open_nursery() as n:
 | 
					        async with tractor.open_nursery(
 | 
				
			||||||
 | 
					            arbiter_addr=arb_addr,
 | 
				
			||||||
 | 
					            enable_modules=[__name__],
 | 
				
			||||||
 | 
					        ) as n:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            portal = await n.start_actor(
 | 
					            portal = await n.start_actor(
 | 
				
			||||||
                'streamer',
 | 
					                'streamer',
 | 
				
			||||||
                rpc_module_paths=[__name__],
 | 
					                enable_modules=[__name__],
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
            async with tractor.wait_for_actor('streamer'):
 | 
					            async with tractor.wait_for_actor('streamer'):
 | 
				
			||||||
                # block until 2nd actor is initialized
 | 
					                # block until 2nd actor is initialized
 | 
				
			||||||
| 
						 | 
					@ -283,8 +289,4 @@ def test_single_subactor_pub_multitask_subs(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            await portal.cancel_actor()
 | 
					            await portal.cancel_actor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    tractor.run(
 | 
					    trio.run(main)
 | 
				
			||||||
        main,
 | 
					 | 
				
			||||||
        arbiter_addr=arb_addr,
 | 
					 | 
				
			||||||
        rpc_module_paths=[__name__],
 | 
					 | 
				
			||||||
    )
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue