Add a `debug_mode`-state reversion test
							parent
							
								
									faa681da21
								
							
						
					
					
						commit
						c93a7d9b24
					
				| 
						 | 
				
			
			@ -83,3 +83,26 @@ def test_implicit_root_via_first_nursery(
 | 
			
		|||
            assert tractor.current_actor().aid.name == 'root'
 | 
			
		||||
 | 
			
		||||
    trio.run(main)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_runtime_vars_unset(
 | 
			
		||||
    reg_addr: tuple,
 | 
			
		||||
    debug_mode: bool
 | 
			
		||||
):
 | 
			
		||||
    '''
 | 
			
		||||
    Ensure any `._state._runtime_vars` are restored to default values
 | 
			
		||||
    after the root actor-runtime exits!
 | 
			
		||||
 | 
			
		||||
    '''
 | 
			
		||||
    assert not tractor._state._runtime_vars['_debug_mode']
 | 
			
		||||
    async def main():
 | 
			
		||||
        assert not tractor._state._runtime_vars['_debug_mode']
 | 
			
		||||
        async with tractor.open_nursery(
 | 
			
		||||
            debug_mode=True,
 | 
			
		||||
        ):
 | 
			
		||||
            assert tractor._state._runtime_vars['_debug_mode']
 | 
			
		||||
 | 
			
		||||
        # after runtime closure, should be reverted!
 | 
			
		||||
        assert not tractor._state._runtime_vars['_debug_mode']
 | 
			
		||||
 | 
			
		||||
    trio.run(main)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue