This message was deleted.
# python
s
This message was deleted.
w
When the value of
some_output
is available (either after a resource is created or updated) the Pulumi engine will cause that future to be resolved with the value of the resource returned by the cloud provider.
w
Ahh - sorry - missed that "test" part of your question. In unit tests, resource outputs are never resolved, except for outputs that are the same name as inputs - which will be resolved to the value of the input. See https://github.com/pulumi/pulumi/pull/2638#issuecomment-483809925 for some additional commentary on this.
w
that makes sense — but our problem is with Python specifically. tests will hang if there is an async test and a non-async test in the same file. we are using pytest-asyncio
in particular, this seems to happen if our infrastructure is imported more than once in a file — we import it in every test function as shown in Joe's example
e.g., the second test here will hang:
Copy code
def test_bucket_name_is_my_bucket():
    from infrastructure import bucket_name

    assert bucket_name() == "my-bucket"


@pytest.mark.asyncio
async def test_bucket_urn_is_my_bucket():
    from infrastructure import bucket

    bucket_urn = await get_output(bucket.urn)

    assert bucket_urn.endswith("aws:s3/bucket:Bucket::my-bucket")


def get_output(output):
    future = asyncio.Future()
    output.apply(lambda value: future.set_result(value))
    return future
but if i remove the first test, the async test runs with no problem.