forked from goodboy/tractor
				
			Fix some borked tests
							parent
							
								
									333ddcf93f
								
							
						
					
					
						commit
						59421d9f3a
					
				| 
						 | 
					@ -61,10 +61,11 @@ def run_example_in_subproc(loglevel, testdir, arb_addr):
 | 
				
			||||||
                str(script_file),
 | 
					                str(script_file),
 | 
				
			||||||
            ]
 | 
					            ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # XXX: BE FOREVER WARNED: if you enable lots of tractor logging
 | 
				
			||||||
 | 
					        # in the subprocess it may cause infinite blocking on the pipes
 | 
				
			||||||
 | 
					        # due to backpressure!!!
 | 
				
			||||||
        proc = testdir.popen(
 | 
					        proc = testdir.popen(
 | 
				
			||||||
            cmdargs,
 | 
					            cmdargs,
 | 
				
			||||||
            stdout=subprocess.PIPE,
 | 
					 | 
				
			||||||
            stderr=subprocess.PIPE,
 | 
					 | 
				
			||||||
            **kwargs,
 | 
					            **kwargs,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        assert not proc.returncode
 | 
					        assert not proc.returncode
 | 
				
			||||||
| 
						 | 
					@ -101,6 +102,8 @@ def test_example(run_example_in_subproc, example_script):
 | 
				
			||||||
        with run_example_in_subproc(code) as proc:
 | 
					        with run_example_in_subproc(code) as proc:
 | 
				
			||||||
            proc.wait()
 | 
					            proc.wait()
 | 
				
			||||||
            err, _ = proc.stderr.read(), proc.stdout.read()
 | 
					            err, _ = proc.stderr.read(), proc.stdout.read()
 | 
				
			||||||
 | 
					            # print(f'STDERR: {err}')
 | 
				
			||||||
 | 
					            # print(f'STDOUT: {out}')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            # if we get some gnarly output let's aggregate and raise
 | 
					            # if we get some gnarly output let's aggregate and raise
 | 
				
			||||||
            errmsg = err.decode()
 | 
					            errmsg = err.decode()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -35,8 +35,9 @@ async def test_self_is_registered(arb_addr):
 | 
				
			||||||
    "Verify waiting on the arbiter to register itself using the standard api."
 | 
					    "Verify waiting on the arbiter to register itself using the standard api."
 | 
				
			||||||
    actor = tractor.current_actor()
 | 
					    actor = tractor.current_actor()
 | 
				
			||||||
    assert actor.is_arbiter
 | 
					    assert actor.is_arbiter
 | 
				
			||||||
    async with tractor.wait_for_actor('arbiter') as portal:
 | 
					    with trio.fail_after(0.2):
 | 
				
			||||||
        assert portal.channel.uid[0] == 'arbiter'
 | 
					        async with tractor.wait_for_actor('root') as portal:
 | 
				
			||||||
 | 
					            assert portal.channel.uid[0] == 'root'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@tractor_test
 | 
					@tractor_test
 | 
				
			||||||
| 
						 | 
					@ -46,7 +47,9 @@ async def test_self_is_registered_localportal(arb_addr):
 | 
				
			||||||
    assert actor.is_arbiter
 | 
					    assert actor.is_arbiter
 | 
				
			||||||
    async with tractor.get_arbiter(*arb_addr) as portal:
 | 
					    async with tractor.get_arbiter(*arb_addr) as portal:
 | 
				
			||||||
        assert isinstance(portal, tractor._portal.LocalPortal)
 | 
					        assert isinstance(portal, tractor._portal.LocalPortal)
 | 
				
			||||||
        sockaddr = await portal.run_from_ns('self', 'wait_for_actor', name='arbiter')
 | 
					
 | 
				
			||||||
 | 
					        with trio.fail_after(0.2):
 | 
				
			||||||
 | 
					            sockaddr = await portal.run_from_ns('self', 'wait_for_actor', name='root')
 | 
				
			||||||
            assert sockaddr[0] == arb_addr
 | 
					            assert sockaddr[0] == arb_addr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -244,7 +244,10 @@ async def open_nursery(
 | 
				
			||||||
                # the above "daemon actor" nursery will be notified.
 | 
					                # the above "daemon actor" nursery will be notified.
 | 
				
			||||||
                async with trio.open_nursery() as ria_nursery:
 | 
					                async with trio.open_nursery() as ria_nursery:
 | 
				
			||||||
                    anursery = ActorNursery(
 | 
					                    anursery = ActorNursery(
 | 
				
			||||||
                        actor, ria_nursery, da_nursery, errors
 | 
					                        actor,
 | 
				
			||||||
 | 
					                        ria_nursery,
 | 
				
			||||||
 | 
					                        da_nursery,
 | 
				
			||||||
 | 
					                        errors
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                    try:
 | 
					                    try:
 | 
				
			||||||
                        # spawning of actors happens in the caller's scope
 | 
					                        # spawning of actors happens in the caller's scope
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue