forked from goodboy/tractor
				
			Get remaining suites passing..
..by ensuring `reg_addr` fixture value passthrough to subactor epsremotes/1757153874605917753/main
							parent
							
								
									3d2b6613e8
								
							
						
					
					
						commit
						cfb74e588d
					
				|  | @ -203,7 +203,7 @@ def ctlc( | |||
|         # XXX: disable pygments highlighting for auto-tests | ||||
|         # since some envs (like actions CI) will struggle | ||||
|         # the the added color-char encoding.. | ||||
|         from tractor._debug import TractorConfig | ||||
|         from tractor.devx._debug import TractorConfig | ||||
|         TractorConfig.use_pygements = False | ||||
| 
 | ||||
|     yield use_ctlc | ||||
|  | @ -685,7 +685,7 @@ def test_multi_daemon_subactors( | |||
|     # now the root actor won't clobber the bp_forever child | ||||
|     # during it's first access to the debug lock, but will instead | ||||
|     # wait for the lock to release, by the edge triggered | ||||
|     # ``_debug.Lock.no_remote_has_tty`` event before sending cancel messages | ||||
|     # ``devx._debug.Lock.no_remote_has_tty`` event before sending cancel messages | ||||
|     # (via portals) to its underlings B) | ||||
| 
 | ||||
|     # at some point here there should have been some warning msg from | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ from tractor._testing import ( | |||
| def run_example_in_subproc( | ||||
|     loglevel: str, | ||||
|     testdir, | ||||
|     arb_addr: tuple[str, int], | ||||
|     reg_addr: tuple[str, int], | ||||
| ): | ||||
| 
 | ||||
|     @contextmanager | ||||
|  |  | |||
|  | @ -15,9 +15,19 @@ async def sleep_back_actor( | |||
|     func_name, | ||||
|     func_defined, | ||||
|     exposed_mods, | ||||
|     *, | ||||
|     reg_addr: tuple, | ||||
| ): | ||||
|     if actor_name: | ||||
|         async with tractor.find_actor(actor_name) as portal: | ||||
|         async with tractor.find_actor( | ||||
|             actor_name, | ||||
|             # NOTE: must be set manually since | ||||
|             # the subactor doesn't have the reg_addr | ||||
|             # fixture code run in it! | ||||
|             # TODO: maybe we should just set this once in the | ||||
|             # _state mod and derive to all children? | ||||
|             registry_addrs=[reg_addr], | ||||
|         ) as portal: | ||||
|             try: | ||||
|                 await portal.run(__name__, func_name) | ||||
|             except tractor.RemoteActorError as err: | ||||
|  | @ -52,11 +62,17 @@ async def short_sleep(): | |||
|         'fail_on_syntax', | ||||
|     ], | ||||
| ) | ||||
| def test_rpc_errors(reg_addr, to_call, testdir): | ||||
|     """Test errors when making various RPC requests to an actor | ||||
| def test_rpc_errors( | ||||
|     reg_addr, | ||||
|     to_call, | ||||
|     testdir, | ||||
| ): | ||||
|     ''' | ||||
|     Test errors when making various RPC requests to an actor | ||||
|     that either doesn't have the requested module exposed or doesn't define | ||||
|     the named function. | ||||
|     """ | ||||
| 
 | ||||
|     ''' | ||||
|     exposed_mods, funcname, inside_err = to_call | ||||
|     subactor_exposed_mods = [] | ||||
|     func_defined = globals().get(funcname, False) | ||||
|  | @ -84,8 +100,13 @@ def test_rpc_errors(reg_addr, to_call, testdir): | |||
| 
 | ||||
|         # spawn a subactor which calls us back | ||||
|         async with tractor.open_nursery( | ||||
|             arbiter_addr=reg_addr, | ||||
|             registry_addrs=[reg_addr], | ||||
|             enable_modules=exposed_mods.copy(), | ||||
| 
 | ||||
|             # NOTE: will halt test in REPL if uncommented, so only | ||||
|             # do that if actually debugging subactor but keep it | ||||
|             # disabled for the test. | ||||
|             # debug_mode=True, | ||||
|         ) as n: | ||||
| 
 | ||||
|             actor = tractor.current_actor() | ||||
|  | @ -102,6 +123,7 @@ def test_rpc_errors(reg_addr, to_call, testdir): | |||
|                 exposed_mods=exposed_mods, | ||||
|                 func_defined=True if func_defined else False, | ||||
|                 enable_modules=subactor_exposed_mods, | ||||
|                 reg_addr=reg_addr, | ||||
|             ) | ||||
| 
 | ||||
|     def run(): | ||||
|  |  | |||
|  | @ -32,8 +32,7 @@ async def spawn( | |||
| 
 | ||||
|         if actor.is_arbiter: | ||||
| 
 | ||||
|             async with tractor.open_nursery( | ||||
|             ) as nursery: | ||||
|             async with tractor.open_nursery() as nursery: | ||||
| 
 | ||||
|                 # forks here | ||||
|                 portal = await nursery.run_in_actor( | ||||
|  | @ -55,7 +54,9 @@ async def spawn( | |||
|             return 10 | ||||
| 
 | ||||
| 
 | ||||
| def test_local_arbiter_subactor_global_state(reg_addr): | ||||
| def test_local_arbiter_subactor_global_state( | ||||
|     reg_addr, | ||||
| ): | ||||
|     result = trio.run( | ||||
|         spawn, | ||||
|         True, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue