From 59421d9f3a6acb435f04d266c986829440e6b638 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 8 Jan 2021 20:40:49 -0500 Subject: [PATCH] Fix some borked tests --- tests/test_docs_examples.py | 7 +++++-- tests/test_local.py | 11 +++++++---- tractor/_trionics.py | 5 ++++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/tests/test_docs_examples.py b/tests/test_docs_examples.py index 73e6a69..ea676a2 100644 --- a/tests/test_docs_examples.py +++ b/tests/test_docs_examples.py @@ -61,10 +61,11 @@ def run_example_in_subproc(loglevel, testdir, arb_addr): 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( cmdargs, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, **kwargs, ) 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: proc.wait() 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 errmsg = err.decode() diff --git a/tests/test_local.py b/tests/test_local.py index ef64795..60e875b 100644 --- a/tests/test_local.py +++ b/tests/test_local.py @@ -35,8 +35,9 @@ async def test_self_is_registered(arb_addr): "Verify waiting on the arbiter to register itself using the standard api." actor = tractor.current_actor() assert actor.is_arbiter - async with tractor.wait_for_actor('arbiter') as portal: - assert portal.channel.uid[0] == 'arbiter' + with trio.fail_after(0.2): + async with tractor.wait_for_actor('root') as portal: + assert portal.channel.uid[0] == 'root' @tractor_test @@ -46,8 +47,10 @@ async def test_self_is_registered_localportal(arb_addr): assert actor.is_arbiter async with tractor.get_arbiter(*arb_addr) as portal: assert isinstance(portal, tractor._portal.LocalPortal) - sockaddr = await portal.run_from_ns('self', 'wait_for_actor', name='arbiter') - assert sockaddr[0] == arb_addr + + with trio.fail_after(0.2): + sockaddr = await portal.run_from_ns('self', 'wait_for_actor', name='root') + assert sockaddr[0] == arb_addr def test_local_actor_async_func(arb_addr): diff --git a/tractor/_trionics.py b/tractor/_trionics.py index b6fe0dc..9e61cab 100644 --- a/tractor/_trionics.py +++ b/tractor/_trionics.py @@ -244,7 +244,10 @@ async def open_nursery( # the above "daemon actor" nursery will be notified. async with trio.open_nursery() as ria_nursery: anursery = ActorNursery( - actor, ria_nursery, da_nursery, errors + actor, + ria_nursery, + da_nursery, + errors ) try: # spawning of actors happens in the caller's scope