Has anyone been able to run `pulumi_aws.iam.get_po...
# python
p
Has anyone been able to run
pulumi_aws.iam.get_policy_document
under Pytest? It works when running normally with Pulumi, but when run under Pytest with a test decorated by
pulumi.runtime.test
it fails with the error in the thread.
Copy code
__________________________________________________ test_component _____________________________________________________

args = (), kwargs = {}

    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        from .. import Output  # pylint: disable=import-outside-toplevel
    
        try:
>           _sync_await(
                run_pulumi_func(
                    lambda: _sync_await(Output.from_input(fn(*args, **kwargs)).future())
                )
            )

../../.pyenv/versions/3.10.7/envs/redacted/lib/python3.10/site-packages/pulumi/runtime/mocks.py:54: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.pyenv/versions/3.10.7/envs/redacted/lib/python3.10/site-packages/pulumi/runtime/sync_await.py:54: in _sync_await
    return loop.run_until_complete(fut)
../../.pyenv/versions/3.10.7/lib/python3.10/asyncio/base_events.py:646: in run_until_complete
    return future.result()
../../.pyenv/versions/3.10.7/envs/redacted/lib/python3.10/site-packages/pulumi/runtime/stack.py:51: in run_pulumi_func
    await wait_for_rpcs()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

await_all_outstanding_tasks = True

    async def wait_for_rpcs(await_all_outstanding_tasks=True) -> None:
        log.debug("Waiting for outstanding RPCs to complete")

        while True:
            # Pump the event loop, giving all of the RPCs that we just queued up time to fully execute.
            # The asyncio scheduler does not expose a "yield" primitive, so this will have to do.
            #
            # Note that "asyncio.sleep(0)" is the blessed way to do this:
            # <https://github.com/python/asyncio/issues/284#issuecomment-154180935>
            #
            # We await each RPC in turn so that this loop will actually block rather than busy-wait.
            while len(RPC_MANAGER.rpcs) > 0:
                await asyncio.sleep(0)
                log.debug(
                    f"waiting for quiescence; {len(RPC_MANAGER.rpcs)} RPCs outstanding"
                )
>               await RPC_MANAGER.rpcs.pop()
E               TypeError: 'NoneType' object is not iterable

../../.pyenv/versions/3.10.7/envs/redacted/lib/python3.10/site-packages/pulumi/runtime/stack.py:73: TypeError
Another issue is that earlier on in the test I run
task_definition = awsx.ecs.FargateTaskDefinition(...)
, and later when I call
task_definition.task_definition.arn
I get the error:
Copy code
AttributeError: 'NoneType' object has no attribute 'arn'
Why is
task_definition.task_definition
an
Output[TaskDefinition]
when running under
pulumi up
, but
None
when running under Pytest?